2023-11-03 18:25:19 +00:00
|
|
|
#!/usr/bin/env bash
|
2019-09-13 17:52:28 +00:00
|
|
|
|
2021-01-12 16:16:14 +00:00
|
|
|
# Parse optional flag -k, to be used when we want to base the process on an existing Pipfile.lock
|
|
|
|
KEEP_LOCK=false
|
|
|
|
OPTIND=1
|
|
|
|
while getopts 'k' opt; do
|
|
|
|
case $opt in
|
|
|
|
k) KEEP_LOCK=true ;;
|
|
|
|
*) echo 'Error in command line parsing' >&2
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
shift "$(( OPTIND - 1 ))"
|
|
|
|
|
2021-01-06 01:58:12 +00:00
|
|
|
# can change output file names with relock_dependencies.sh <prefix>
|
2019-09-13 17:52:28 +00:00
|
|
|
PREFIX=${1:-requirements}
|
|
|
|
|
2020-04-24 17:48:03 +00:00
|
|
|
# these steps might fail, but that's okay.
|
2021-01-12 16:16:14 +00:00
|
|
|
if ! "$KEEP_LOCK"; then
|
|
|
|
echo "Removing existing Pipfile.lock file"
|
|
|
|
rm -f Pipfile.lock
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Removing existing requirement files"
|
2019-09-13 17:52:28 +00:00
|
|
|
pipenv --rm
|
|
|
|
rm -f $PREFIX.txt
|
|
|
|
rm -f dev-$PREFIX.txt
|
|
|
|
|
2023-04-20 14:07:36 +00:00
|
|
|
echo "Removing pip cache"
|
|
|
|
pip cache purge
|
2019-09-13 17:52:28 +00:00
|
|
|
|
2020-04-24 17:48:03 +00:00
|
|
|
# start enforcing failures
|
|
|
|
set -e
|
2019-09-13 17:52:28 +00:00
|
|
|
|
2020-04-24 17:48:03 +00:00
|
|
|
echo "Building Development Requirements"
|
2023-11-03 18:24:59 +00:00
|
|
|
pipenv --python 3.12 lock --clear --pre --dev-only
|
2023-04-13 18:55:45 +00:00
|
|
|
pipenv requirements --dev-only > dev-$PREFIX.txt
|
2019-09-13 17:52:28 +00:00
|
|
|
|
2020-04-24 17:48:03 +00:00
|
|
|
echo "Building Standard Requirements"
|
2023-11-03 18:24:59 +00:00
|
|
|
pipenv --python 3.12 lock --clear --pre
|
2023-04-13 18:55:45 +00:00
|
|
|
pipenv requirements > $PREFIX.txt
|
2019-09-13 17:52:28 +00:00
|
|
|
|
|
|
|
echo "OK!"
|