зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1396582) for build bustage "ImportError: No module named which". r=backout a=backout on a CLOSED TREE
Backed out changeset a677efcd8768 (bug 1396582) Backed out changeset 4e81669959ed (bug 1396582)
This commit is contained in:
Родитель
1be9ea36da
Коммит
3b53e85664
|
@ -203,6 +203,7 @@ option(env='PYTHON', nargs=1, help='Python interpreter')
|
||||||
@imports('subprocess')
|
@imports('subprocess')
|
||||||
@imports(_from='mozbuild.configure.util', _import='LineIO')
|
@imports(_from='mozbuild.configure.util', _import='LineIO')
|
||||||
@imports(_from='mozbuild.virtualenv', _import='VirtualenvManager')
|
@imports(_from='mozbuild.virtualenv', _import='VirtualenvManager')
|
||||||
|
@imports(_from='mozbuild.virtualenv', _import='verify_python_version')
|
||||||
@imports('distutils.sysconfig')
|
@imports('distutils.sysconfig')
|
||||||
def virtualenv_python(env_python, build_env, mozconfig, help):
|
def virtualenv_python(env_python, build_env, mozconfig, help):
|
||||||
if help:
|
if help:
|
||||||
|
@ -223,28 +224,8 @@ def virtualenv_python(env_python, build_env, mozconfig, help):
|
||||||
elif 'PYTHON' in mozconfig['vars']['modified']:
|
elif 'PYTHON' in mozconfig['vars']['modified']:
|
||||||
python = mozconfig['vars']['modified']['PYTHON'][1]
|
python = mozconfig['vars']['modified']['PYTHON'][1]
|
||||||
|
|
||||||
minimum_version = Version('2.7.3')
|
with LineIO(lambda l: log.error(l)) as out:
|
||||||
major, minor, micro = sys.version_info[:3]
|
verify_python_version(out)
|
||||||
our_version = Version('%d.%d.%d' % (major, minor, micro))
|
|
||||||
|
|
||||||
if major != 2 or our_version < minimum_version:
|
|
||||||
msg = ('Python %s or greater (but not Python 3) is required to build. '
|
|
||||||
'You are running Python %s. ' % (minimum_version, our_version))
|
|
||||||
|
|
||||||
if os.name == 'nt':
|
|
||||||
msg += ('Please upgrade to the latest MozillaBuild development '
|
|
||||||
'environment. See https://developer.mozilla.org/en-US/docs/Developer_Guide/Build_Instructions/Windows_Prerequisites')
|
|
||||||
else:
|
|
||||||
msg += ('Run `mach bootstrap` to ensure your system is up to date. '
|
|
||||||
'If you still receive this error afterwards, your shell '
|
|
||||||
'environment is likely detecting another Python version. '
|
|
||||||
'Ensure a modern Python can be found in the paths defined '
|
|
||||||
'by the $PATH environment variable. Or set the PYTHON '
|
|
||||||
'environment or mozconfig variable to specify which Python '
|
|
||||||
'interpreter to use.')
|
|
||||||
|
|
||||||
die(msg)
|
|
||||||
|
|
||||||
topsrcdir, topobjdir = build_env.topsrcdir, build_env.topobjdir
|
topsrcdir, topobjdir = build_env.topsrcdir, build_env.topobjdir
|
||||||
if topobjdir.endswith('/js/src'):
|
if topobjdir.endswith('/js/src'):
|
||||||
topobjdir = topobjdir[:-7]
|
topobjdir = topobjdir[:-7]
|
||||||
|
|
|
@ -20,6 +20,24 @@ IS_NATIVE_WIN = (sys.platform == 'win32' and os.sep == '\\')
|
||||||
IS_MSYS2 = (sys.platform == 'win32' and os.sep == '/')
|
IS_MSYS2 = (sys.platform == 'win32' and os.sep == '/')
|
||||||
IS_CYGWIN = (sys.platform == 'cygwin')
|
IS_CYGWIN = (sys.platform == 'cygwin')
|
||||||
|
|
||||||
|
# Minimum version of Python required to build.
|
||||||
|
MINIMUM_PYTHON_VERSION = LooseVersion('2.7.3')
|
||||||
|
MINIMUM_PYTHON_MAJOR = 2
|
||||||
|
|
||||||
|
|
||||||
|
UPGRADE_WINDOWS = '''
|
||||||
|
Please upgrade to the latest MozillaBuild development environment. See
|
||||||
|
https://developer.mozilla.org/en-US/docs/Developer_Guide/Build_Instructions/Windows_Prerequisites
|
||||||
|
'''.lstrip()
|
||||||
|
|
||||||
|
UPGRADE_OTHER = '''
|
||||||
|
Run |mach bootstrap| to ensure your system is up to date.
|
||||||
|
|
||||||
|
If you still receive this error, your shell environment is likely detecting
|
||||||
|
another Python version. Ensure a modern Python can be found in the paths
|
||||||
|
defined by the $PATH environment variable and try again.
|
||||||
|
'''.lstrip()
|
||||||
|
|
||||||
|
|
||||||
class VirtualenvManager(object):
|
class VirtualenvManager(object):
|
||||||
"""Contains logic for managing virtualenvs for building the tree."""
|
"""Contains logic for managing virtualenvs for building the tree."""
|
||||||
|
@ -505,3 +523,47 @@ class VirtualenvManager(object):
|
||||||
# self.python_path. However, this seems more risk than it's worth.
|
# self.python_path. However, this seems more risk than it's worth.
|
||||||
subprocess.check_call([os.path.join(self.bin_path, 'pip')] + args,
|
subprocess.check_call([os.path.join(self.bin_path, 'pip')] + args,
|
||||||
stderr=subprocess.STDOUT)
|
stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
|
|
||||||
|
def verify_python_version(log_handle):
|
||||||
|
"""Ensure the current version of Python is sufficient."""
|
||||||
|
major, minor, micro = sys.version_info[:3]
|
||||||
|
|
||||||
|
our = LooseVersion('%d.%d.%d' % (major, minor, micro))
|
||||||
|
|
||||||
|
if major != MINIMUM_PYTHON_MAJOR or our < MINIMUM_PYTHON_VERSION:
|
||||||
|
log_handle.write('Python %s or greater (but not Python 3) is '
|
||||||
|
'required to build. ' % MINIMUM_PYTHON_VERSION)
|
||||||
|
log_handle.write('You are running Python %s.\n' % our)
|
||||||
|
|
||||||
|
if os.name in ('nt', 'ce'):
|
||||||
|
log_handle.write(UPGRADE_WINDOWS)
|
||||||
|
else:
|
||||||
|
log_handle.write(UPGRADE_OTHER)
|
||||||
|
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
if len(sys.argv) < 5:
|
||||||
|
print('Usage: populate_virtualenv.py /path/to/topsrcdir /path/to/topobjdir /path/to/virtualenv /path/to/virtualenv_manifest')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
verify_python_version(sys.stdout)
|
||||||
|
|
||||||
|
topsrcdir, topobjdir, virtualenv_path, manifest_path = sys.argv[1:5]
|
||||||
|
populate = False
|
||||||
|
|
||||||
|
# This should only be called internally.
|
||||||
|
if sys.argv[1] == 'populate':
|
||||||
|
populate = True
|
||||||
|
topsrcdir, topobjdir, virtualenv_path, manifest_path = sys.argv[2:]
|
||||||
|
|
||||||
|
manager = VirtualenvManager(topsrcdir, topobjdir, virtualenv_path,
|
||||||
|
sys.stdout, manifest_path)
|
||||||
|
|
||||||
|
if populate:
|
||||||
|
manager.populate()
|
||||||
|
else:
|
||||||
|
manager.ensure()
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче