MQTT Home Emulation
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 603B

1234567891011121314151617181920212223
  1. #!/bin/bash
  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. find $BASEPATH -name requirements.txt | xargs -L 1 $BASEPATH/venv/bin/pip install -r > /dev/null 2>&1
  10. echo "venv changed"
  11. fi
  12. #
  13. # Update venv modules
  14. #
  15. for req_mod in $($BASEPATH/venv/bin/pip list --format=json | jq -r '.[] | .name'); do
  16. $BASEPATH/venv/bin/pip install -U $req_mod | grep install > /dev/null 2>&1
  17. if [[ "$?" -eq "0" ]]; then
  18. echo $req_mod changed
  19. fi
  20. done
  21. #|xargs -n1 $BASEPATH/venv/bin/pip install -U