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 |
Matteo Scandolo | 5687972 | 2017-05-17 21:39:54 -0700 | [diff] [blame] | 26 | if \ |
| 27 | pip install cryptography --global-option=build_ext --global-option="-L/usr/local/opt/openssl/lib" --global-option="-I/usr/local/opt/openssl/include" && \ |
| 28 | pip install -r $REQUIREMENTS && \ |
Matteo Scandolo | 4a99b2c | 2017-06-22 10:31:44 -0700 | [diff] [blame] | 29 | cd $BASEDIR/lib/xos-config; python setup.py install && \ |
Matteo Scandolo | 67654fa | 2017-06-09 09:33:17 -0700 | [diff] [blame^] | 30 | |
Matteo Scandolo | 4a99b2c | 2017-06-22 10:31:44 -0700 | [diff] [blame] | 31 | #install xos-client |
| 32 | cp -R $BASEDIR/containers/xos/tmp.chameleon $BASEDIR/xos/xos_client/xosapi/chameleon && \ |
| 33 | cd $BASEDIR/xos/xos_client/xosapi/chameleon/protos; VOLTHA_BASE=anything make && \ |
| 34 | cd $BASEDIR/xos/xos_client; python setup.py install && \ |
| 35 | chmod 777 $BASEDIR/venv-xos/lib/python2.7/site-packages/xosapi/chameleon/protoc_plugins/gw_gen.py && \ |
Matteo Scandolo | 67654fa | 2017-06-09 09:33:17 -0700 | [diff] [blame^] | 36 | chmod 777 $BASEDIR/venv-xos/lib/python2.7/site-packages/xosapi/chameleon/protoc_plugins/swagger_gen.py && \ |
| 37 | cd $BASEDIR/lib/xos-genx; python setup.py install |
Matteo Scandolo | 297eb26 | 2017-05-15 17:00:53 -0700 | [diff] [blame] | 38 | then |
| 39 | echo "Requirements installed." |
| 40 | echo "Virtualenv ready" |
| 41 | else |
| 42 | echo "An error occurred" |
| 43 | fi |
Matteo Scandolo | 5687972 | 2017-05-17 21:39:54 -0700 | [diff] [blame] | 44 | cd $BASEDIR |