-
-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathupdate_requirements.sh
More file actions
executable file
·38 lines (29 loc) · 1.01 KB
/
update_requirements.sh
File metadata and controls
executable file
·38 lines (29 loc) · 1.01 KB
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
35
36
37
38
#!/bin/bash
# Usage: ./update_requirements.sh [--upgrade]
# Finds all requirements.in files and runs pip-compile on them.
# Add --upgrade flag to update all packages to their latest versions.
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
UPGRADE_FLAG=""
if [[ "$1" == "--upgrade" ]]; then
UPGRADE_FLAG="--upgrade"
echo "Running with --upgrade flag to get latest package versions"
fi
echo "Searching for requirements.in files..."
COUNT=0
while IFS= read -r req_file; do
dir_path=$(dirname "$req_file")
echo "Found: $req_file"
pushd "$dir_path" > /dev/null
echo "Running pip-compile on $req_file..."
if pip-compile $UPGRADE_FLAG --strip-extras; then
echo -e "${GREEN}Successfully compiled $req_file${NC}"
COUNT=$((COUNT + 1))
else
echo -e "${RED}Failed to compile $req_file${NC}"
fi
popd > /dev/null
echo "-----------------------------------"
done < <(find . -name "requirements.in" -type f)
echo "Compilation complete. Processed $COUNT requirements.in files."