ensure-venv.sh 443 B

123456789101112131415161718192021
  1. #!/bin/bash
  2. set -xe
  3. # optionally opt out of virtualenv creation
  4. if [ "x$SENTRY_NO_VIRTUALENV_CREATION" == "x1" ]; then
  5. exit 0
  6. fi
  7. # if we already have a venv, we can leave
  8. if .venv/bin/python --version &> /dev/null; then
  9. exit 0
  10. fi
  11. # do we have a WORKON_HOME? Prime from there
  12. if [ "x$WORKON_HOME" != x ]; then
  13. ln -s "${WORKON_HOME}/sentry" .venv
  14. exit 0
  15. fi
  16. # otherwise make a new virtualenv from scratch
  17. virtualenv -ppython2.7 .venv