Fix tools/provision on OS X.

See the comment for details.
This commit is contained in:
Zev Benjamin 2018-11-29 20:18:28 -08:00 committed by Tim Abbott
parent a7094a47dc
commit df04e4e1ca

View file

@ -76,8 +76,15 @@ the Python version this command is executed with."""
# `import_module`.
activate_module_dir = os.path.abspath(os.path.join(venv_dir, venv_exec_dir))
sys.path.append(activate_module_dir)
import_module('activate_this')
# On OS X, ensure we use the virtualenv version of the python binary for
# future subprocesses instead of the version that this script was launched with. See
# https://stackoverflow.com/questions/26323852/whats-the-meaning-of-pyvenv-launcher-environment-variable
if '__PYVENV_LAUNCHER__' in os.environ:
del os.environ['__PYVENV_LAUNCHER__']
# In order to install all required packages for the venv, `pip` needs to be executed by
# the venv's Python interpreter. `--prefix venv_dir` ensures that all modules are installed
# in the right place.