Unset __PYVENV_LAUNCHER__ to fix init_venv on OS X.

For some weird reason, pip installed logilab.common into /usr/local when
launching it via subprocess, because __PYVENV_LAUNCHER__ was set...
This commit is contained in:
Florian Bruhin 2015-01-18 00:05:08 +01:00
parent dbd0d1fff9
commit ddc4e7b309

View File

@ -91,11 +91,15 @@ def venv_python(*args, output=False):
"""Call the virtualenv's python with the given arguments."""
subdir = 'Scripts' if os.name == 'nt' else 'bin'
executable = os.path.join(g_path, subdir, os.path.basename(sys.executable))
env = dict(os.environ)
if sys.platform == 'darwin' and '__PYVENV_LAUNCHER__' in env:
# WORKAROUND for https://github.com/pypa/pip/issues/2031
del env['__PYVENV_LAUNCHER__']
if output:
return subprocess.check_output([executable] + list(args),
universal_newlines=True)
universal_newlines=True, env=env)
else:
subprocess.check_call([executable] + list(args))
subprocess.check_call([executable] + list(args), env=env)
def test_toolchain():