setup_venvs: Use system python3.

Otherwise python3 will be perpetually copied from virtualenv to
virtualenv and will never receive updates from the system.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2019-07-23 16:07:28 -07:00 committed by Tim Abbott
parent 82828bdba4
commit 43c9a26afb
1 changed files with 2 additions and 6 deletions

View File

@ -8,7 +8,7 @@ if ZULIP_PATH not in sys.path:
sys.path.append(ZULIP_PATH) sys.path.append(ZULIP_PATH)
from scripts.lib.setup_venv import setup_virtualenv from scripts.lib.setup_venv import setup_virtualenv
from scripts.lib.zulip_tools import overwrite_symlink, subprocess_text_output from scripts.lib.zulip_tools import overwrite_symlink
VENV_PATH = "/srv/zulip-py3-venv" VENV_PATH = "/srv/zulip-py3-venv"
@ -16,15 +16,11 @@ DEV_REQS_FILE = os.path.join(ZULIP_PATH, "requirements", "dev.txt")
THUMBOR_REQS_FILE = os.path.join(ZULIP_PATH, "requirements", "thumbor.txt") THUMBOR_REQS_FILE = os.path.join(ZULIP_PATH, "requirements", "thumbor.txt")
def main() -> None: def main() -> None:
# Get the correct Python interpreter. If we don't do this and use
# `virtualenv -p python3` to create the venv in Travis, the venv
# starts referring to the system Python interpreter.
python_interpreter = subprocess_text_output(['which', 'python3'])
setup_virtualenv("/srv/zulip-thumbor-venv", THUMBOR_REQS_FILE, setup_virtualenv("/srv/zulip-thumbor-venv", THUMBOR_REQS_FILE,
patch_activate_script=True, virtualenv_args=['-p', 'python2.7']) patch_activate_script=True, virtualenv_args=['-p', 'python2.7'])
cached_venv_path = setup_virtualenv( cached_venv_path = setup_virtualenv(
VENV_PATH, DEV_REQS_FILE, patch_activate_script=True, VENV_PATH, DEV_REQS_FILE, patch_activate_script=True,
virtualenv_args=['-p', python_interpreter]) virtualenv_args=['-p', 'python3'])
overwrite_symlink(cached_venv_path, os.path.join(ZULIP_PATH, "zulip-py3-venv")) overwrite_symlink(cached_venv_path, os.path.join(ZULIP_PATH, "zulip-py3-venv"))
if __name__ == "__main__": if __name__ == "__main__":