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 <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2020-02-04 21:56:04 -08:00 committed by Tim Abbott
parent d2e07ea51b
commit 61bf698185
3 changed files with 26 additions and 5 deletions

20
requirements/pip2.txt Normal file
View File

@ -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

View File

@ -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])

View File

@ -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