create-production-venv: Fix missing virtualenv dependency.

On newer distros like Xenial, Stretch, etc., we were incorrectly not
installing the Python 3 version of the virtualenv package.  This was
accidentally working because most base images with Python already have
this package too, but this was failing to install the right
dependencies in our Docker builds, requiring unnecessary manual code.

We fixed this some time ago for provision.py, but not for production.
This commit is contained in:
Tim Abbott
2018-05-18 16:50:44 -07:00
parent 9de80990ea
commit 2655ece96f

View File

@@ -8,13 +8,18 @@ ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__f
if ZULIP_PATH not in sys.path:
sys.path.append(ZULIP_PATH)
from scripts.lib.zulip_tools import run
from scripts.lib.zulip_tools import run, subprocess_text_output
from scripts.lib.setup_venv import setup_virtualenv, VENV_DEPENDENCIES
parser = argparse.ArgumentParser(description="Create a production virtualenv with caching")
parser.add_argument("deploy_path")
args = parser.parse_args()
codename = subprocess_text_output(["lsb_release", "-cs"])
if codename != "trusty":
# Workaround for the fact that trusty has a different package name here.
VENV_DEPENDENCIES.append("virtualenv")
# install dependencies for setting up the virtualenv
run(["apt-get", "-y", "install"] + VENV_DEPENDENCIES)