Files
zulip/scripts/lib/create-thumbor-venv
Anders Kaseorg 365fe0b3d5 python: Sort imports with isort.
Fixes #2665.

Regenerated by tabbott with `lint --fix` after a rebase and change in
parameters.

Note from tabbott: In a few cases, this converts technical debt in the
form of unsorted imports into different technical debt in the form of
our largest files having very long, ugly import sequences at the
start.  I expect this change will increase pressure for us to split
those files, which isn't a bad thing.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-11 16:45:32 -07:00

36 lines
1.1 KiB
Python
Executable File

#!/usr/bin/env python3
import argparse
import os
import sys
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
if ZULIP_PATH not in sys.path:
sys.path.append(ZULIP_PATH)
from scripts.lib.setup_venv import (
THUMBOR_VENV_DEPENDENCIES,
YUM_THUMBOR_VENV_DEPENDENCIES,
setup_virtualenv,
)
from scripts.lib.zulip_tools import os_families, parse_os_release, run
parser = argparse.ArgumentParser(description="Create a thumbor virtualenv with caching")
parser.add_argument("deploy_path")
args = parser.parse_args()
# install dependencies for setting up the virtualenv
distro_info = parse_os_release()
if "debian" in os_families():
run(["apt-get", "-y", "install"] + THUMBOR_VENV_DEPENDENCIES)
elif "fedora" in os_families():
run(["yum", "-y", "install"] + YUM_THUMBOR_VENV_DEPENDENCIES)
else:
print("Unsupported platform: {}".format(distro_info['ID']))
sys.exit(1)
venv_name = "zulip-thumbor-venv"
cached_venv_path = setup_virtualenv(
os.path.join(args.deploy_path, venv_name),
os.path.join(ZULIP_PATH, "requirements", "thumbor.txt"),
python2=True)