Bug 1669934: Virtualenv should use the correct python packages r=firefox-build-system-reviewers,glandium

Due to the MacOS `__PYVENV_LAUNCHER__` environment variable, some
virtualenv operations were being run with the system python (and
packages), rather than the python and packages within the venv.

This was already partially solved by having `__PYVENV_LAUNCHER__`
get unset when some virtualenv operations were run.
This change makes this more consistent by unsetting the environment
variable once a `VirtualenvManager` is created.

Differential Revision: https://phabricator.services.mozilla.com/D93615
This commit is contained in:
Mitchell Hentges 2020-10-16 16:14:22 +00:00
parent b51b43a0ee
commit 5835177a65

View File

@ -103,6 +103,11 @@ class VirtualenvManager(VirtualenvHelper):
"""
super(VirtualenvManager, self).__init__(virtualenv_path)
# __PYVENV_LAUNCHER__ confuses pip, telling it to use the system
# python interpreter rather than the local virtual environment interpreter.
# See https://bugzilla.mozilla.org/show_bug.cgi?id=1607470
os.environ.pop('__PYVENV_LAUNCHER__', None)
assert os.path.isabs(
manifest_path), "manifest_path must be an absolute path: %s" % (manifest_path)
self.topsrcdir = topsrcdir
@ -212,9 +217,6 @@ class VirtualenvManager(VirtualenvHelper):
This should be the main API used from this class as it is the
highest-level.
"""
# __PYVENV_LAUNCHER__ confuses pip about the python interpreter
# See https://bugzilla.mozilla.org/show_bug.cgi?id=1607470
os.environ.pop('__PYVENV_LAUNCHER__', None)
if self.up_to_date(python):
return self.virtualenv_root
return self.build(python)
@ -501,9 +503,6 @@ class VirtualenvManager(VirtualenvHelper):
else:
thismodule = __file__
# __PYVENV_LAUNCHER__ confuses pip about the python interpreter
# See https://bugzilla.mozilla.org/show_bug.cgi?id=1635481
os.environ.pop('__PYVENV_LAUNCHER__', None)
args = [self.python_path, thismodule, 'populate', self.topsrcdir,
self.virtualenv_root, self.manifest_path]
if self.populate_local_paths: