#!/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