From 61bf6981855961bac2449ba3fc0b531cd44644f8 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Tue, 4 Feb 2020 21:56:04 -0800 Subject: [PATCH] requirements: Fork pip.txt to pip2.txt for Python 2. The current version of setuptools no longer supports Python 2. Signed-off-by: Anders Kaseorg --- requirements/pip2.txt | 20 ++++++++++++++++++++ scripts/lib/setup_venv.py | 10 +++++----- tools/update-locked-requirements | 1 + 3 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 requirements/pip2.txt diff --git a/requirements/pip2.txt b/requirements/pip2.txt new file mode 100644 index 0000000000..dd698fadd9 --- /dev/null +++ b/requirements/pip2.txt @@ -0,0 +1,20 @@ +# +# This file is GENERATED. Don't edit directly. +# +# To update, edit the non-"lock" files in requirements/*.txt, then: +# +# tools/update-locked-requirements +# +# For details, see requirements/README.md . +# +wheel==0.33.6 \ + --hash=sha256:10c9da68765315ed98850f8e048347c3eb06dd81822dc2ab1d4fde9dc9702646 \ + --hash=sha256:f4da1763d3becf2e2cd92a14a7c920f0f00eca30fdde9ea992c836685b9faf28 + +# The following packages are considered to be unsafe in a requirements file: +pip==19.3.1 \ + --hash=sha256:21207d76c1031e517668898a6b46a9fb1501c7a4710ef5dfd6a40ad9e6757ea7 \ + --hash=sha256:6917c65fc3769ecdc61405d3dfd97afdedd75808d200b2838d7d961cebc0c2c7 +setuptools==42.0.2 \ + --hash=sha256:c5b372090d7c8709ce79a6a66872a91e518f7d65af97fca78135e1cb10d4b940 \ + --hash=sha256:c8abd0f3574bc23afd2f6fd2c415ba7d9e097c8a99b845473b0d957ba1e2dac6 diff --git a/scripts/lib/setup_venv.py b/scripts/lib/setup_venv.py index e6487e11b5..2879bccc00 100644 --- a/scripts/lib/setup_venv.py +++ b/scripts/lib/setup_venv.py @@ -99,9 +99,9 @@ YUM_THUMBOR_VENV_DEPENDENCIES = [ "gifsicle", ] -def install_venv_deps(pip, requirements_file): - # type: (str, str) -> None - pip_requirements = os.path.join(ZULIP_PATH, "requirements", "pip.txt") +def install_venv_deps(pip, requirements_file, python2): + # type: (str, str, bool) -> None + pip_requirements = os.path.join(ZULIP_PATH, "requirements", "pip2.txt" if python2 else "pip.txt") run([pip, "install", "--force-reinstall", "--require-hashes", "--requirement", pip_requirements]) run([pip, "install", "--no-deps", "--require-hashes", "--requirement", requirements_file]) @@ -330,10 +330,10 @@ def do_setup_virtualenv(venv_path, requirements_file, python2): add_cert_to_pipconf() try: - install_venv_deps(pip, requirements_file) + install_venv_deps(pip, requirements_file, python2) except subprocess.CalledProcessError: # Might be a failure due to network connection issues. Retrying... print(WARNING + "`pip install` failed; retrying..." + ENDC) - install_venv_deps(pip, requirements_file) + install_venv_deps(pip, requirements_file, python2) run_as_root(["chmod", "-R", "a+rX", venv_path]) diff --git a/tools/update-locked-requirements b/tools/update-locked-requirements index 01e28e4b4a..f365fabf67 100755 --- a/tools/update-locked-requirements +++ b/tools/update-locked-requirements @@ -59,5 +59,6 @@ compile_requirements requirements/prod.in "$OUTPUT_BASE_DIR/prod.txt" compile_requirements requirements/dev.in "$OUTPUT_BASE_DIR/dev.txt" compile_requirements requirements/mypy.in "$OUTPUT_BASE_DIR/mypy.txt" compile_requirements requirements/docs.in "$OUTPUT_BASE_DIR/docs.txt" +compile_requirements requirements/pip.in "$OUTPUT_BASE_DIR/pip2.txt" py2 compile_requirements requirements/thumbor.in "$OUTPUT_BASE_DIR/thumbor.txt" py2 compile_requirements requirements/thumbor-dev.in "$OUTPUT_BASE_DIR/thumbor-dev.txt" py2