Smarthome Functionen
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

init_venv 652B

123456789101112131415161718192021222324
  1. #!/bin/sh
  2. #
  3. BASEPATH=`realpath $(dirname $0)`
  4. #
  5. # Create venv
  6. #
  7. if [[ ! -e $BASEPATH/venv ]]; then
  8. python3 -m venv $BASEPATH/venv > /dev/null 2>&1
  9. # $BASEPATH/venv/bin/pip install --upgrade pip
  10. find $BASEPATH -name requirements.txt | xargs -L 1 $BASEPATH/venv/bin/pip install -r > /dev/null 2>&1
  11. echo "venv changed"
  12. fi
  13. #
  14. # Update venv modules
  15. #
  16. for req_mod in $($BASEPATH/venv/bin/pip list --format=json | jq -r '.[] | .name'); do
  17. $BASEPATH/venv/bin/pip install -U $req_mod | grep install > /dev/null 2>&1
  18. if [[ "$?" -eq "0" ]]; then
  19. echo $req_mod changed
  20. fi
  21. done
  22. #|xargs -n1 $BASEPATH/venv/bin/pip install -U