Matteo Scandolo | 297eb26 | 2017-05-15 17:00:53 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | BASEDIR=$(pwd) |
| 4 | REQUIREMENTS=$BASEDIR/containers/xos/pip_requirements.txt |
| 5 | VENVDIR=venv-xos |
| 6 | |
| 7 | echo $BASEDIR |
| 8 | echo $REQUIREMENTS |
| 9 | echo $VENVDIR |
| 10 | |
| 11 | # create venv if it's not yet there |
| 12 | if [ ! -d "$BASEDIR/$VENVDIR" ]; then |
| 13 | echo "Setting up virtualenv for XOS" |
| 14 | virtualenv -q $BASEDIR/$VENVDIR --no-site-packages |
| 15 | pip install --upgrade pip |
| 16 | echo "Virtualenv created." |
| 17 | fi |
| 18 | |
| 19 | # activate the virtual env |
| 20 | if [ ! $VIRTUAL_ENV ]; then |
| 21 | source $BASEDIR/$VENVDIR/bin/activate |
| 22 | echo "Virtualenv activated." |
| 23 | fi |
| 24 | |
| 25 | # install pip requirements |
| 26 | if pip install -r $REQUIREMENTS |
| 27 | then |
| 28 | echo "Requirements installed." |
| 29 | echo "Virtualenv ready" |
| 30 | else |
| 31 | echo "An error occurred" |
| 32 | fi |