2024-03-24 13:19:07 +01:00

25 wiersze
654 B
Bash
Executable File

#!/bin/bash
#
BASEPATH=`realpath $(dirname $0)`
#
# Create venv
#
if [[ ! -e $BASEPATH/venv ]]; then
python3 -m venv $BASEPATH/venv > /dev/null 2>&1
# $BASEPATH/venv/bin/pip install --upgrade pip
find $BASEPATH -name requirements.txt | xargs -L 1 $BASEPATH/venv/bin/pip install -r > /dev/null 2>&1
echo "venv changed"
fi
#
# Update venv modules
#
for req_mod in $($BASEPATH/venv/bin/pip list --format=json | jq -r '.[] | .name'); do
$BASEPATH/venv/bin/pip install -U $req_mod | grep install > /dev/null 2>&1
if [[ "$?" -eq "0" ]]; then
echo $req_mod changed
fi
done
#|xargs -n1 $BASEPATH/venv/bin/pip install -U