mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
deps: Refactor tools/update-locked-requirements to save repeating the filenames.
My first version of this just replaced the repeated list of two output
files with an array variable, but I decided `"${outputs[@]}"` was too
much to ask people to understand, and the alternative of `$outputs`,
unquoted, encourages bad habits of shell programming. So just handle
one file at a time; the only at all expensive part here is `pip-compile`.
I am tempted to move this to Python, but holding back.
This commit is contained in:
@@ -7,14 +7,22 @@ if [ ! -d /srv/zulip-py3-venv ]; then
|
|||||||
fi
|
fi
|
||||||
source /srv/zulip-py3-venv/bin/activate
|
source /srv/zulip-py3-venv/bin/activate
|
||||||
|
|
||||||
pip-compile --output-file requirements/prod_lock.txt requirements/prod.txt
|
compile_requirements () {
|
||||||
pip-compile --output-file requirements/dev_lock.txt requirements/dev.txt
|
source="$1"
|
||||||
|
output="$2"
|
||||||
|
|
||||||
# Remove the editable flag in the lock files. It's there because pip-compile
|
pip-compile --output-file "$output" "$source"
|
||||||
# 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 //' requirements/prod_lock.txt requirements/dev_lock.txt
|
|
||||||
|
|
||||||
# pip-tools bug; future, futures are obsolete in python3
|
# Remove the editable flag. It's there because pip-compile can't
|
||||||
sed -i '/futures==/d' requirements/prod_lock.txt requirements/dev_lock.txt
|
# yet do without it (see
|
||||||
sed -i '/future==/d' requirements/prod_lock.txt requirements/dev_lock.txt
|
# 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"
|
||||||
|
|
||||||
|
# pip-tools bug; future, futures are obsolete in python3
|
||||||
|
sed -i '/futures==/d' "$output"
|
||||||
|
sed -i '/future==/d' "$output"
|
||||||
|
}
|
||||||
|
|
||||||
|
compile_requirements requirements/prod.txt requirements/prod_lock.txt
|
||||||
|
compile_requirements requirements/dev.txt requirements/dev_lock.txt
|
||||||
|
|||||||
Reference in New Issue
Block a user