Bug 1675675 - Only put mach_bootstrap paths in PYTHONPATH for mach python --no-virtualenv. r=firefox-build-system-reviewers,rstewart

With PYTHONPATH containing other directories, such as the python ones,
bad things can happen when the python script that is being run then
goes on to subprocess.Popen a python process for a different virtualenv,
or a different version, or whatever.

Differential Revision: https://phabricator.services.mozilla.com/D96155
This commit is contained in:
Mike Hommey
2020-11-06 17:30:58 +00:00
parent 97aaada220
commit 005133952f
2 changed files with 11 additions and 5 deletions

View File

@@ -61,8 +61,10 @@ class MachCommands(MachCommandBase):
}
if no_virtualenv:
from mach_bootstrap import mach_sys_path
python_path = sys.executable
append_env["PYTHONPATH"] = os.pathsep.join(sys.path)
append_env["PYTHONPATH"] = os.pathsep.join(mach_sys_path(self.topsrcdir))
else:
self.activate_virtualenv()
python_path = self.virtualenv_manager.python_path