Ensure virtualenv is run throughout the entire Travis dev provision.

This commit is contained in:
rht 2017-06-17 15:14:59 +02:00 committed by Tim Abbott
parent 463f69fd1b
commit 532bd6eaa6
2 changed files with 26 additions and 23 deletions

View File

@ -244,22 +244,10 @@ def main(options):
print(WARNING + "`npm install` failed; retrying..." + ENDC)
setup_node_modules()
if options.is_travis:
if PY2:
MYPY_REQS_FILE = os.path.join(ZULIP_PATH, "requirements", "mypy.txt")
setup_virtualenv(PY3_VENV_PATH, MYPY_REQS_FILE, patch_activate_script=True,
virtualenv_args=['-p', 'python3'])
DEV_REQS_FILE = os.path.join(ZULIP_PATH, "requirements", "py2_dev.txt")
setup_virtualenv(PY2_VENV_PATH, DEV_REQS_FILE, patch_activate_script=True)
else:
DEV_REQS_FILE = os.path.join(ZULIP_PATH, "requirements", "py3_dev.txt")
setup_virtualenv(VENV_PATH, DEV_REQS_FILE, patch_activate_script=True,
virtualenv_args=['-p', 'python3'])
else:
# Import tools/setup_venv.py instead of running it so that we get an
# activated virtualenv for the rest of the provisioning process.
from tools.setup import setup_venvs
setup_venvs.main()
# Import tools/setup_venv.py instead of running it so that we get an
# activated virtualenv for the rest of the provisioning process.
from tools.setup import setup_venvs
setup_venvs.main(options.is_travis)
# Put Python2 virtualenv activation in .bash_profile.
setup_shell_profile('~/.bash_profile')

View File

@ -10,14 +10,29 @@ if ZULIP_PATH not in sys.path:
from scripts.lib.setup_venv import setup_virtualenv
def main():
# type: () -> None
PY2_DEV_REQS_FILE = os.path.join(ZULIP_PATH, "requirements", "py2_dev.txt")
setup_virtualenv("/srv/zulip-venv", PY2_DEV_REQS_FILE, patch_activate_script=True)
PY2_VENV_PATH = "/srv/zulip-venv"
PY3_VENV_PATH = "/srv/zulip-py3-venv"
PY3_DEV_REQS_FILE = os.path.join(ZULIP_PATH, "requirements", "py3_dev.txt")
setup_virtualenv("/srv/zulip-py3-venv", PY3_DEV_REQS_FILE, patch_activate_script=True,
virtualenv_args=['-p', 'python3'])
PY2_DEV_REQS_FILE = os.path.join(ZULIP_PATH, "requirements", "py2_dev.txt")
PY3_DEV_REQS_FILE = os.path.join(ZULIP_PATH, "requirements", "py3_dev.txt")
PY2 = sys.version_info[0] == 2
def main(is_travis=False):
# type: (bool) -> None
if is_travis:
if PY2:
MYPY_REQS_FILE = os.path.join(ZULIP_PATH, "requirements", "mypy.txt")
setup_virtualenv(PY3_VENV_PATH, MYPY_REQS_FILE, patch_activate_script=True,
virtualenv_args=['-p', 'python3'])
setup_virtualenv(PY2_VENV_PATH, PY2_DEV_REQS_FILE, patch_activate_script=True)
else:
setup_virtualenv(PY3_VENV_PATH, PY3_DEV_REQS_FILE, patch_activate_script=True,
virtualenv_args=['-p', 'python3'])
else:
setup_virtualenv(PY2_VENV_PATH, PY2_DEV_REQS_FILE, patch_activate_script=True)
setup_virtualenv(PY3_VENV_PATH, PY3_DEV_REQS_FILE, patch_activate_script=True,
virtualenv_args=['-p', 'python3'])
if __name__ == "__main__":
main()