forked from openedx-unsupported/configuration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
post-pip-compile.sh
executable file
·34 lines (30 loc) · 980 Bytes
/
post-pip-compile.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
set -e
# Remove any cruft from a requirements file generated by pip-tools which we don't want to keep
function show_help {
echo "Usage: post-pip-compile.sh file ..."
echo "Remove any cruft left behind by pip-compile in the given requirements file(s)."
echo ""
echo "Updates the instructions for re-generating each requirements file, and removes"
echo "\"-e\" prefixes which were added to GitHub URLs only so that pip-compile could"
echo "process them correctly."
}
function clean_file {
FILE_PATH=$1
TEMP_FILE=${FILE_PATH}.tmp
# Replace the instructions for regenerating the output file.
sed "s/pip-compile --output-file.*/make upgrade/" ${FILE_PATH} > ${TEMP_FILE}
mv ${TEMP_FILE} ${FILE_PATH}
}
for i in "$@"; do
case ${i} in
-h|--help)
# help or unknown option
show_help
exit 0
;;
*)
clean_file ${i}
;;
esac
done