Always unset __PYVENV_LAUNCHER__ environment variable to avoid unwanted surprises

This commit is contained in:
Yannick Jadoul
2020-02-27 16:56:47 +01:00
parent 7d0cc37b17
commit 1199d78d88
+4 -1
View File
@@ -133,6 +133,9 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef
installation_bin_path,
env['PATH'],
])
# Fix issue with site.py setting the wrong `sys.prefix`, `sys.exec_prefix`, `sys.path`, ... for PyPy: https://foss.heptapod.net/pypy/pypy/issues/3175
# Be safe and avoid other issues by just always removing the '__PYVENV_LAUNCHER__' environment variable (cfr. https://github.com/python/cpython/pull/9516)
env.pop('__PYVENV_LAUNCHER__', None)
env = environment.as_dictionary(prev_environment=env)
# check what version we're on
@@ -203,7 +206,7 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef
])
# Fix some weird issue with the shebang of installed scripts
# See https://github.com/theacodes/nox/issues/44 and https://github.com/pypa/virtualenv/issues/620
virtualenv_env.pop('__PYVENV_LAUNCHER__', None)
# virtualenv_env.pop('__PYVENV_LAUNCHER__', None) # No need for this anymore, as '__PYVENV_LAUNCHER__' is already removed from `env` above
# check that we are using the Python from the virtual environment
call(['which', 'python'], env=virtualenv_env)