blob: b0b045b6edb697e2f7a3b26a79ef3bf3cf19514d [file] [log] [blame]
Matteo Scandolo297eb262017-05-15 17:00:53 -07001#!/bin/bash
2
Matteo Scandolod2044a42017-08-07 16:08:28 -07003# Copyright 2017-present Open Networking Foundation
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
Matteo Scandolo297eb262017-05-15 17:00:53 -070017BASEDIR=$(pwd)
18REQUIREMENTS=$BASEDIR/containers/xos/pip_requirements.txt
19VENVDIR=venv-xos
20
21echo $BASEDIR
22echo $REQUIREMENTS
23echo $VENVDIR
24
25# create venv if it's not yet there
26if [ ! -d "$BASEDIR/$VENVDIR" ]; then
27 echo "Setting up virtualenv for XOS"
28 virtualenv -q $BASEDIR/$VENVDIR --no-site-packages
29 pip install --upgrade pip
30 echo "Virtualenv created."
31fi
32
33# activate the virtual env
34if [ ! $VIRTUAL_ENV ]; then
35 source $BASEDIR/$VENVDIR/bin/activate
36 echo "Virtualenv activated."
37fi
38
39# install pip requirements
Matteo Scandolo56879722017-05-17 21:39:54 -070040if \
41pip install cryptography --global-option=build_ext --global-option="-L/usr/local/opt/openssl/lib" --global-option="-I/usr/local/opt/openssl/include" && \
42pip install -r $REQUIREMENTS && \
Matteo Scandolo4a99b2c2017-06-22 10:31:44 -070043cd $BASEDIR/lib/xos-config; python setup.py install && \
Matteo Scandolo67654fa2017-06-09 09:33:17 -070044
Matteo Scandolo4a99b2c2017-06-22 10:31:44 -070045#install xos-client
46cp -R $BASEDIR/containers/xos/tmp.chameleon $BASEDIR/xos/xos_client/xosapi/chameleon && \
47cd $BASEDIR/xos/xos_client/xosapi/chameleon/protos; VOLTHA_BASE=anything make && \
48cd $BASEDIR/xos/xos_client; python setup.py install && \
49chmod 777 $BASEDIR/venv-xos/lib/python2.7/site-packages/xosapi/chameleon/protoc_plugins/gw_gen.py && \
Matteo Scandolo67654fa2017-06-09 09:33:17 -070050chmod 777 $BASEDIR/venv-xos/lib/python2.7/site-packages/xosapi/chameleon/protoc_plugins/swagger_gen.py && \
51cd $BASEDIR/lib/xos-genx; python setup.py install
Matteo Scandolo297eb262017-05-15 17:00:53 -070052 then
53 echo "Requirements installed."
54 echo "Virtualenv ready"
55 else
56 echo "An error occurred"
57fi
Matteo Scandolo56879722017-05-17 21:39:54 -070058cd $BASEDIR