2016-10-11 06:30:28 +02:00
|
|
|
#!/usr/bin/env python
|
2016-06-22 21:00:50 +02:00
|
|
|
|
|
|
|
import os
|
|
|
|
import argparse
|
|
|
|
from os.path import dirname, abspath
|
|
|
|
import sys
|
|
|
|
|
|
|
|
ZULIP_PATH = dirname(dirname(dirname(abspath(__file__))))
|
|
|
|
if ZULIP_PATH not in sys.path:
|
|
|
|
sys.path.append(ZULIP_PATH)
|
|
|
|
|
2016-08-13 17:46:19 +02:00
|
|
|
from scripts.lib.zulip_tools import run
|
2016-06-22 21:00:50 +02:00
|
|
|
from scripts.lib.setup_venv import setup_virtualenv, VENV_DEPENDENCIES
|
|
|
|
|
|
|
|
parser = argparse.ArgumentParser(description="Create a production virtualenv with caching")
|
|
|
|
parser.add_argument("target")
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
# install dependencies for setting up the virtualenv
|
|
|
|
run(["apt-get", "-y", "install"] + VENV_DEPENDENCIES)
|
|
|
|
|
2016-10-11 06:30:28 +02:00
|
|
|
python_version = sys.version_info[0]
|
|
|
|
|
|
|
|
cached_venv_path = setup_virtualenv(
|
|
|
|
args.target,
|
|
|
|
os.path.join(ZULIP_PATH, "requirements", "py{}_prod.txt".format(python_version)),
|
|
|
|
virtualenv_args=['-p', 'python{}'.format(python_version)])
|
2016-06-22 21:00:50 +02:00
|
|
|
# Now the virtualenv has been activated
|