Skip to content

Commit

Permalink
Unset __PYVENV_LAUNCHER__ on macOS to avoid virtualenv weirdness (#28663
Browse files Browse the repository at this point in the history
)
  • Loading branch information
foolip committed Apr 28, 2021
1 parent 559ae84 commit b2c62f3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tools/wpt/virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ def working_set(self):
return self._working_set

def activate(self):
if sys.platform == 'darwin':
# The default Python on macOS sets a __PYVENV_LAUNCHER__ environment
# variable which affects invocation of python (e.g. via pip) in a
# virtualenv. Unset it if present to avoid this. More background:
# https://github.com/web-platform-tests/wpt/issues/27377
# https://github.com/python/cpython/pull/9516
os.environ.pop('__PYVENV_LAUNCHER__', None)
path = os.path.join(self.bin_path, "activate_this.py")
with open(path) as f:
exec(f.read(), {"__file__": path})
Expand Down

0 comments on commit b2c62f3

Please sign in to comment.