Use zulip-py3-venv when running on Python 3

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg
2016-11-19 23:45:53 -05:00
committed by Tim Abbott
parent c0f2cebe0c
commit 712c98cb48
4 changed files with 9 additions and 5 deletions

View File

@@ -13,7 +13,7 @@ from scripts.lib.zulip_tools import run
from scripts.lib.setup_venv import setup_virtualenv, VENV_DEPENDENCIES
parser = argparse.ArgumentParser(description="Create a production virtualenv with caching")
parser.add_argument("target")
parser.add_argument("deploy_path")
args = parser.parse_args()
# install dependencies for setting up the virtualenv
@@ -22,7 +22,7 @@ run(["apt-get", "-y", "install"] + VENV_DEPENDENCIES)
python_version = sys.version_info[0]
cached_venv_path = setup_virtualenv(
args.target,
os.path.join(args.deploy_path, "zulip-venv" if sys.version_info[0] == 2 else "zulip-py3-venv"),
os.path.join(ZULIP_PATH, "requirements", "py{}_prod.txt".format(python_version)),
virtualenv_args=['-p', 'python{}'.format(python_version)])
# Now the virtualenv has been activated

View File

@@ -29,7 +29,7 @@ apt-get install -y puppet git python python-six crudini $ADDITIONAL_PACKAGES
# Create and activate a virtualenv
if [ "$VIRTUALENV_NEEDED" = "yes" ]; then
"$ZULIP_PATH"/scripts/lib/create-production-venv "$ZULIP_PATH"/zulip-venv
"$ZULIP_PATH"/scripts/lib/create-production-venv "$ZULIP_PATH"
fi
# puppet apply

View File

@@ -8,7 +8,11 @@ from os.path import dirname, abspath
import sys
BASE_DIR = dirname(dirname(dirname(abspath(__file__))))
activate_this = os.path.join(BASE_DIR, "zulip-venv", "bin", "activate_this.py")
activate_this = os.path.join(
BASE_DIR,
"zulip-venv" if sys.version_info[0] == 2 else "zulip-py3-venv",
"bin",
"activate_this.py")
if os.path.exists(activate_this):
# this file will exist in production
exec(open(activate_this).read(), {}, dict(__file__=activate_this))

View File

@@ -52,7 +52,7 @@ if os.path.islink((os.path.join(deploy_path, "zproject/local_settings.py"))):
subprocess.check_call(["rm", os.path.join(deploy_path, "zproject/local_settings.py")])
subprocess.check_call([os.path.join(deploy_path, "scripts", "lib", "create-production-venv"),
os.path.join(deploy_path, "zulip-venv")])
deploy_path])
if os.path.exists("/etc/supervisor/conf.d/zulip_db.conf"):
subprocess.check_call(["supervisorctl", "stop", "process-fts-updates"], preexec_fn=su_to_zulip)