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.
|
2017-05-12 02:30:38 +02:00
|
|
|
if [ ! -d /srv/zulip-py3-venv ]; then
|
|
|
|
./tools/setup/setup_venvs.py
|
|
|
|
fi
|
2017-09-15 00:45:08 +02:00
|
|
|
source /srv/zulip-py3-venv/bin/activate
|
2017-05-12 02:30:38 +02:00
|
|
|
|
2017-09-15 05:07:39 +02:00
|
|
|
compile_requirements () {
|
|
|
|
source="$1"
|
|
|
|
output="$2"
|
2017-11-11 17:54:19 +01:00
|
|
|
python_version="$3"
|
2017-09-15 00:45:08 +02:00
|
|
|
|
2017-09-15 05:07:39 +02:00
|
|
|
pip-compile --output-file "$output" "$source"
|
2017-09-15 00:45:08 +02:00
|
|
|
|
2017-09-15 05:07:39 +02:00
|
|
|
# Remove the editable flag. It's there because pip-compile can't
|
|
|
|
# yet do without it (see
|
|
|
|
# https://github.com/jazzband/pip-tools/issues/272 upstream), but
|
|
|
|
# in the output of pip-compile it's no longer needed.
|
|
|
|
sed -i 's/-e //' "$output"
|
|
|
|
|
2017-11-11 17:54:19 +01:00
|
|
|
if [ "$python_version" != "py2" ]; then
|
|
|
|
# pip-tools bug; future, futures are obsolete in python3
|
|
|
|
sed -i '/futures==/d' "$output"
|
|
|
|
sed -i '/future==/d' "$output"
|
|
|
|
fi
|
2017-09-15 05:22:38 +02:00
|
|
|
|
|
|
|
(
|
|
|
|
cat <<EOF
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
# This perl invocation strips the existing block of header comments.
|
|
|
|
perl -0pe 's/\A(^#.*\n)*//m' "$output"
|
|
|
|
) | sponge "$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/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/thumbor.in "$OUTPUT_BASE_DIR/thumbor.txt" py2
|