mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
setup.py: Add the --debug switch.
This commit is contained in:
parent
29421f3cd7
commit
3e26a2d7cf
23
setup.py
23
setup.py
@ -34,7 +34,11 @@ import sys
|
|||||||
import tempfile
|
import tempfile
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
debug = '--debug' in sys.argv
|
||||||
|
|
||||||
path = os.path.dirname(__file__)
|
path = os.path.dirname(__file__)
|
||||||
|
if debug:
|
||||||
|
print('DEBUG: Changing dir from %r to %r' % (os.getcwd(), path))
|
||||||
if path:
|
if path:
|
||||||
os.chdir(path)
|
os.chdir(path)
|
||||||
|
|
||||||
@ -64,9 +68,15 @@ if sys.version_info < (2, 6, 0):
|
|||||||
sys.stderr.write("Supybot requires Python 2.6 or newer.")
|
sys.stderr.write("Supybot requires Python 2.6 or newer.")
|
||||||
sys.stderr.write(os.linesep)
|
sys.stderr.write(os.linesep)
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
elif sys.version_info[0] >= 3 and \
|
elif sys.version_info[0] >= 3:
|
||||||
not os.path.split(os.path.abspath(os.path.dirname(__file__)))[-1] == 'py3k':
|
if os.path.split(os.path.abspath(os.path.dirname(__file__)))[-1] == 'py3k':
|
||||||
# The second condition is used to prevent this script to run recursively
|
if debug:
|
||||||
|
print('DEBUG: Running setup.py with Python 3: second stage.')
|
||||||
|
while '--debug' in sys.argv:
|
||||||
|
sys.argv.remove('--debug')
|
||||||
|
else:
|
||||||
|
if debug:
|
||||||
|
print('DEBUG: Running setup.py with Python 3: first stage.')
|
||||||
print('Converting code from Python 2 to Python 3. This make take a '
|
print('Converting code from Python 2 to Python 3. This make take a '
|
||||||
'few minutes.')
|
'few minutes.')
|
||||||
# For some reason, using open(os.devnull) makes the subprocess exit before
|
# For some reason, using open(os.devnull) makes the subprocess exit before
|
||||||
@ -74,9 +84,16 @@ elif sys.version_info[0] >= 3 and \
|
|||||||
subprocess.Popen([sys.executable, os.path.join('2to3', 'run.py')],
|
subprocess.Popen([sys.executable, os.path.join('2to3', 'run.py')],
|
||||||
stdout=tempfile.TemporaryFile(),
|
stdout=tempfile.TemporaryFile(),
|
||||||
stderr=tempfile.TemporaryFile()).wait()
|
stderr=tempfile.TemporaryFile()).wait()
|
||||||
|
if debug:
|
||||||
|
print('DEBUG: Changing dir to py3k/')
|
||||||
os.chdir('py3k')
|
os.chdir('py3k')
|
||||||
|
if debug:
|
||||||
|
print('DEBUG: Running %r' % ([sys.executable] + sys.argv))
|
||||||
subprocess.Popen([sys.executable] + sys.argv).wait()
|
subprocess.Popen([sys.executable] + sys.argv).wait()
|
||||||
exit()
|
exit()
|
||||||
|
else:
|
||||||
|
while '--debug' in sys.argv:
|
||||||
|
sys.argv.remove('--debug')
|
||||||
|
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
Loading…
Reference in New Issue
Block a user