Tools: python: allow passing PYTHON in environment

This commit is contained in:
Jérôme Carretero 2013-09-04 00:35:49 -04:00
parent e87782e58b
commit 1fad148b2c
1 changed files with 2 additions and 6 deletions

View File

@ -515,17 +515,13 @@ def configure(conf):
Detect the python interpreter
"""
v = conf.env
v['PYTHON']=Options.options.python or sys.executable
v['PYTHON'] = Options.options.python or os.environ.get('PYTHON', sys.executable)
if Options.options.pythondir:
v['PYTHONDIR'] = Options.options.pythondir
if Options.options.pythonarchdir:
v['PYTHONARCHDIR'] = Options.options.pythonarchdir
try:
conf.find_program('python', var='PYTHON')
except conf.errors.ConfigurationError:
Logs.warn("could not find a python executable, setting to sys.executable '%s'" % sys.executable)
conf.env.PYTHON = sys.executable
conf.find_program('python', var='PYTHON')
conf.env.PYTHON = conf.cmd_to_list(conf.env.PYTHON)
v['PYCMD'] = '"import sys, py_compile;py_compile.compile(sys.argv[1], sys.argv[2])"'