2017-05-12 02:30:38 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
2017-09-15 00:45:08 +02:00
|
|
|
# Make sure the Zulip dev virtualenv exists, and operate within it.
|
2019-09-23 00:42:40 +02:00
|
|
|
if [ ! -d /srv/zulip-py3-venv ] || [ ! -d /srv/zulip-thumbor-venv ]; then
|
2017-05-12 02:30:38 +02:00
|
|
|
./tools/setup/setup_venvs.py
|
|
|
|
fi
|
|
|
|
|
2017-09-15 05:07:39 +02:00
|
|
|
compile_requirements () {
|
|
|
|
source="$1"
|
|
|
|
output="$2"
|
2017-09-15 00:45:08 +02:00
|
|
|
|
2019-10-03 04:57:13 +02:00
|
|
|
echo "Compiling $output"
|
2020-03-21 04:31:01 +01:00
|
|
|
/srv/zulip-py3-venv/bin/pip-compile --quiet --allow-unsafe --generate-hashes --no-header --output-file "$output" "$source"
|
2017-09-15 05:22:38 +02:00
|
|
|
|
2019-08-25 03:40:10 +02:00
|
|
|
cat - "$output" <<EOF | sponge "$output"
|
2017-09-15 05:22:38 +02:00
|
|
|
#
|
|
|
|
# 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 .
|
|
|
|
#
|
|
|
|
EOF
|
2019-08-25 01:12:15 +02:00
|
|
|
|
|
|
|
# Work around https://github.com/jazzband/pip-tools/issues/268
|
|
|
|
chmod a+r "$output"
|
2017-09-15 05:07:39 +02:00
|
|
|
}
|
|
|
|
|
2017-11-17 02:06:29 +01:00
|
|
|
OUTPUT_BASE_DIR='requirements'
|
2017-09-25 21:02:06 +02:00
|
|
|
|
|
|
|
# Parse arguments.
|
|
|
|
if [ $# -gt 0 ]; then
|
|
|
|
while [ "$1" != "" ]; do
|
|
|
|
case $1 in
|
2017-11-17 02:06:29 +01:00
|
|
|
--output-dir)
|
2017-09-25 21:02:06 +02:00
|
|
|
shift
|
2017-11-17 02:06:29 +01:00
|
|
|
OUTPUT_BASE_DIR=$(readlink -m "$1")
|
2017-09-25 21:02:06 +02:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Invalid arguments passed."
|
2017-11-17 02:06:29 +01:00
|
|
|
echo "Usage: $0 [--output-dir <path-to-output-dir>]"
|
2017-09-25 21:02:06 +02:00
|
|
|
exit
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2018-08-03 02:14:52 +02:00
|
|
|
compile_requirements requirements/dev.in "$OUTPUT_BASE_DIR/dev.txt"
|
2020-04-18 01:45:40 +02:00
|
|
|
for name in pip prod mypy docs; do
|
|
|
|
cp "$OUTPUT_BASE_DIR/dev.txt" "$OUTPUT_BASE_DIR/$name.txt"
|
|
|
|
compile_requirements "requirements/$name.in" "$OUTPUT_BASE_DIR/$name.txt"
|
|
|
|
done
|
|
|
|
|
2020-03-21 04:31:01 +01:00
|
|
|
compile_requirements requirements/thumbor-dev.in "$OUTPUT_BASE_DIR/thumbor-dev.txt"
|
|
|
|
cp "$OUTPUT_BASE_DIR/thumbor-dev.txt" "$OUTPUT_BASE_DIR/thumbor.txt"
|
|
|
|
compile_requirements "requirements/thumbor.in" "$OUTPUT_BASE_DIR/thumbor.txt"
|