From 852c49a44e00edac6f9e57c5b02906da8b294765 Mon Sep 17 00:00:00 2001 From: Eklavya Sharma Date: Wed, 20 Jul 2016 17:58:56 +0530 Subject: [PATCH] Factor out venv-installation into a script. --- tools/provision.py | 5 +---- tools/setup/setup-venvs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) create mode 100755 tools/setup/setup-venvs diff --git a/tools/provision.py b/tools/provision.py index 4c13c032f0..8a3aedda43 100755 --- a/tools/provision.py +++ b/tools/provision.py @@ -178,10 +178,7 @@ def main(): DEV_REQS_FILE = os.path.join(ZULIP_PATH, "requirements", "py3_dev.txt") setup_virtualenv(VENV_PATH, DEV_REQS_FILE, virtualenv_args=['-p', 'python3']) else: - DEV_REQS_FILE = os.path.join(ZULIP_PATH, "requirements", "py2_dev.txt") - setup_virtualenv(PY2_VENV_PATH, DEV_REQS_FILE) - DEV_REQS_FILE = os.path.join(ZULIP_PATH, "requirements", "py3_dev.txt") - setup_virtualenv(PY3_VENV_PATH, DEV_REQS_FILE, virtualenv_args=['-p', 'python3']) + run(["tools/setup/setup-venvs"]) # Put Python2 virtualenv activation in our .bash_profile. with open(os.path.expanduser('~/.bash_profile'), 'w+') as bash_profile: diff --git a/tools/setup/setup-venvs b/tools/setup/setup-venvs new file mode 100755 index 0000000000..9edad1431e --- /dev/null +++ b/tools/setup/setup-venvs @@ -0,0 +1,17 @@ +#!/usr/bin/env python + +import os +import sys +from os.path import dirname, abspath + +ZULIP_PATH = dirname(dirname(dirname(abspath(__file__)))) +if ZULIP_PATH not in sys.path: + sys.path.append(ZULIP_PATH) + +from scripts.lib.setup_venv import setup_virtualenv + +PY2_DEV_REQS_FILE = os.path.join(ZULIP_PATH, "requirements", "py2_dev.txt") +setup_virtualenv("/srv/zulip-venv", PY2_DEV_REQS_FILE) + +PY3_DEV_REQS_FILE = os.path.join(ZULIP_PATH, "requirements", "py3_dev.txt") +setup_virtualenv("/srv/zulip-py3-venv", PY3_DEV_REQS_FILE, virtualenv_args=['-p', 'python3'])