requirements: Compile thumbor requirements with pip-tools on Python 2.

The reason that `pip-tools` running on Python 3 didn’t detect the
right requirements for `thumbor` on Python 2 is simply that some of
them are conditional on the Python version.

As for the requirements that had been manually added as a workaround:
`backports-abc` and `singledispatch` are now correctly detected, while
`backports.ssl-match-hostname` was vendored into `urllib3` some time
ago and `certifi` is no longer necessary.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg
2019-09-22 15:42:40 -07:00
committed by Tim Abbott
parent 3c0f54e242
commit 92b42573fb
7 changed files with 54 additions and 20 deletions

View File

@@ -2,19 +2,20 @@
set -e
# Make sure the Zulip dev virtualenv exists, and operate within it.
if [ ! -d /srv/zulip-py3-venv ]; then
if [ ! -d /srv/zulip-py3-venv ] || [ ! -d /srv/zulip-thumbor-venv ]; then
./tools/setup/setup_venvs.py
fi
source /srv/zulip-py3-venv/bin/activate
compile_requirements () {
source="$1"
output="$2"
python_version="$3"
pip-compile --quiet --allow-unsafe --no-header --output-file "$output" "$source"
if [ "$python_version" == "py2" ]; then
/srv/zulip-thumbor-venv/bin/pip-compile --quiet --allow-unsafe --no-header --output-file "$output" "$source"
else
/srv/zulip-py3-venv/bin/pip-compile --quiet --allow-unsafe --no-header --output-file "$output" "$source"
if [ "$python_version" != "py2" ]; then
# Remove an unnecessary future requirement declared by commonmark,
# python-jose, and python-twitter.
# https://github.com/readthedocs/commonmark.py/pull/188
@@ -64,3 +65,4 @@ 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/thumbor.in "$OUTPUT_BASE_DIR/thumbor.txt" py2
compile_requirements requirements/thumbor-dev.in "$OUTPUT_BASE_DIR/thumbor-dev.txt" py2