зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1455708 - Find Python 3 in MozillaBuild, require Python 3 everywhere; r=mshal
We previously did not require Python 3.5+ everywhere because we failed to detect Python 3.5 on Windows in CI. That's because CI isn't using start-shell.bat and it hasn't yet updated PATH to include %MOZILLABUILD%\python3. We shouldn't need to teach CI to have PATH contain everything in MozillaBuild. This commit teaches moz.configure to automatically use MozillaBuild's Python 3 if we're running in MozillaBuild. Since we can now detect Python 3 everywhere in CI, we make Python 3.5+ required on all build configurations. MozReview-Commit-ID: BwgWGeYMyPM --HG-- extra : rebase_source : b52f604b01c73b0493b142f3f71aa26c99a42b91
This commit is contained in:
Родитель
725229a2eb
Коммит
8f5adf5328
|
@ -368,14 +368,13 @@ def shell(value, mozillabuild):
|
|||
option(env='PYTHON3', nargs=1, help='Python 3 interpreter (3.5 or later)')
|
||||
|
||||
|
||||
@depends('PYTHON3', 'MOZ_AUTOMATION')
|
||||
@depends('PYTHON3', 'MOZILLABUILD')
|
||||
@checking('for Python 3',
|
||||
callback=lambda x: '%s (%s)' % (x.path, x.str_version) if x else 'no')
|
||||
@imports(_from='__builtin__', _import='Exception')
|
||||
@imports('platform')
|
||||
@imports(_from='mozbuild.pythonutil', _import='find_python3_executable')
|
||||
@imports(_from='mozbuild.pythonutil', _import='python_executable_version')
|
||||
def python3(env_python, automation):
|
||||
def python3(env_python, mozillabuild):
|
||||
python = env_python[0] if env_python else None
|
||||
|
||||
# If Python given by environment variable, it must work.
|
||||
|
@ -385,10 +384,15 @@ def python3(env_python, automation):
|
|||
except Exception as e:
|
||||
raise FatalCheckError('could not determine version of PYTHON '
|
||||
'(%s): %s' % (python, e))
|
||||
elif mozillabuild:
|
||||
# MozillaBuild provides a Python 3.
|
||||
python = normsep('%s/python3/python3.exe' % mozillabuild)
|
||||
|
||||
if version < (3, 5, 0):
|
||||
raise FatalCheckError('PYTHON3 must point to Python 3.5 or newer; '
|
||||
'%d.%d found' % (version[0], version[1]))
|
||||
try:
|
||||
version = python_executable_version(python).version
|
||||
except Exception as e:
|
||||
raise FatalCheckError('could not determine version of '
|
||||
'MozillaBuild python: %s' % e)
|
||||
else:
|
||||
# Fall back to the search routine.
|
||||
python, version = find_python3_executable(min_version='3.5.0')
|
||||
|
@ -397,19 +401,17 @@ def python3(env_python, automation):
|
|||
if python:
|
||||
python = python.decode('utf-8')
|
||||
|
||||
# Outside of automation, require Python 3.5.
|
||||
# In automation, only require where it is known to be installed.
|
||||
require = not automation or platform.system() == 'Linux'
|
||||
|
||||
if not python:
|
||||
if not require:
|
||||
return None
|
||||
|
||||
raise FatalCheckError('Python 3.5 or newer is required to build. '
|
||||
'Ensure a `python3.x` executable is in your '
|
||||
'PATH or define PYTHON3 to point to a Python '
|
||||
'3.5 executable.')
|
||||
|
||||
if version < (3, 5, 0):
|
||||
raise FatalCheckError('Python 3.5 or newer is required to build; '
|
||||
'%s is Python %d.%d' % (python, version[0],
|
||||
version[1]))
|
||||
|
||||
return namespace(
|
||||
path=python,
|
||||
version=version,
|
||||
|
|
Загрузка…
Ссылка в новой задаче