41 lines
1.0 KiB
Bash
Executable File
41 lines
1.0 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
VENV_PATH='./.venv'
|
|
|
|
update(){
|
|
fd requirements.txt ~ | while read -r filename; do
|
|
echo "Updating : $filename"
|
|
|
|
python -m venv --upgrade-deps "$VENV_PATH"
|
|
if [ -f "$VENV_PATH"/Scripts/activate ]; then . "$VENV_PATH"/Scripts/activate
|
|
elif [ -f "$VENV_PATH"/bin/activate ]; then . "$VENV_PATH"/bin/activate
|
|
else exit 1; fi
|
|
grep -e '^[^#]' "$filename" | cut -d = -f 1 | xargs pip install -U
|
|
|
|
TEMP_FILE=$(mktemp)
|
|
pip freeze | grep -E "($(grep -e '^[^#]' "$filename" | cut -d = -f 1 | paste -sd \|))=" > "$TEMP_FILE"
|
|
nvim -d "$filename" "$TEMP_FILE"
|
|
|
|
deactivate
|
|
rm -rf "$VENV_PATH" "$TEMP_FILE"
|
|
done
|
|
}
|
|
|
|
download(){
|
|
python -m venv --upgrade-deps "$VENV_PATH"
|
|
if [ -f "$VENV_PATH"/Scripts/activate ]; then . "$VENV_PATH"/Scripts/activate
|
|
elif [ -f "$VENV_PATH"/bin/activate ]; then . "$VENV_PATH"/bin/activate
|
|
else exit 1; fi
|
|
|
|
fd requirements.txt ~ | while read -r filename; do
|
|
echo "Downloading : $filename"
|
|
grep -e '^[^#]' "$filename" | cut -d = -f 1 | xargs pip download
|
|
rm *.whl
|
|
done
|
|
|
|
deactivate
|
|
rm -rf "$VENV_PATH"
|
|
}
|
|
|
|
update
|