mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 16:25:38 +00:00
Bug 1670167 - Fix janky Python 3 logic in configure
from bug 1656993 r=firefox-build-system-reviewers,glandium
The `try : import mozfile; except ImportError: ...` thing was completely broken since it unconditionally triggered [this exception](https://searchfox.org/mozilla-central/rev/165e8d8f80c02605c2f3e89c5de462abfce91c32/python/mozbuild/mozbuild/configure/__init__.py#248). The `MOZBUILD_VIRTUALENV` thing should work now, so just use that as a signal for whether we're already in the `virtualenv` instead. Also delete some `PATH` munging in `building.py`, which I think should be unnecessary after we make the above change. Differential Revision: https://phabricator.services.mozilla.com/D93138
This commit is contained in:
parent
301407fb5e
commit
d8915aa0c8
@ -296,16 +296,13 @@ def virtualenv_python3(env_python, virtualenv_name, build_env, mozconfig, help):
|
||||
|
||||
# If we're not in the virtualenv, we need to update the path to include some
|
||||
# necessary modules for find_program.
|
||||
try:
|
||||
import mozfile
|
||||
except ImportError:
|
||||
if 'MOZBUILD_VIRTUALENV' in os.environ:
|
||||
python = sys.executable
|
||||
else:
|
||||
sys.path.insert(
|
||||
0, os.path.join(topsrcdir, 'testing', 'mozbase', 'mozfile'))
|
||||
sys.path.insert(
|
||||
0, os.path.join(topsrcdir, 'third_party', 'python', 'backports'))
|
||||
else:
|
||||
if 'MOZBUILD_VIRTUALENV' in os.environ or not python:
|
||||
python = sys.executable
|
||||
|
||||
# If we know the Python executable the caller is asking for then verify its
|
||||
# version. If the caller did not ask for a specific executable then find
|
||||
|
@ -292,7 +292,7 @@ class ConfigureSandbox(dict):
|
||||
for b in ('None', 'False', 'True', 'int', 'bool', 'any', 'all', 'len',
|
||||
'list', 'tuple', 'set', 'dict', 'isinstance', 'getattr',
|
||||
'hasattr', 'enumerate', 'range', 'zip', 'AssertionError',
|
||||
'ImportError', '__build_class__', # will be None on py2
|
||||
'__build_class__', # will be None on py2
|
||||
)
|
||||
}, __import__=forbidden_import, str=six.text_type)
|
||||
|
||||
|
@ -1561,12 +1561,6 @@ class BuildDriver(MozbuildObject):
|
||||
}, 'Adding make options from {path}\n {content}')
|
||||
|
||||
append_env['OBJDIR'] = mozpath.normsep(self.topobjdir)
|
||||
if (mozpath.normpath(os.path.dirname(sys.executable)) not in
|
||||
[mozpath.normpath(s) for s in
|
||||
os.environ['PATH'].split(os.pathsep)]):
|
||||
append_env['PATH'] = (
|
||||
os.path.dirname(sys.executable) + os.pathsep +
|
||||
os.environ['PATH'])
|
||||
|
||||
return self._run_make(srcdir=True,
|
||||
filename='client.mk',
|
||||
|
Loading…
Reference in New Issue
Block a user