blob: 73effb1a2529acd76630e8f77aec02d30a3955bf [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)
Matteo Scandolo0e852b92018-04-03 14:33:06 -070018REQUIREMENTS=$BASEDIR/containers/xos/pip_requested.txt
Matteo Scandolo297eb262017-05-15 17:00:53 -070019VENVDIR=venv-xos
20
21echo $BASEDIR
22echo $REQUIREMENTS
23echo $VENVDIR
24
25# create venv if it's not yet there
26if [ ! -d "$BASEDIR/$VENVDIR" ]; then
Matteo Scandolo9b849eb2017-09-14 13:44:33 -070027 echo "Setting up virtualenv for XOS"
28 virtualenv -q $BASEDIR/$VENVDIR --no-site-packages
29 pip install --upgrade pip
30 echo "Virtualenv created."
Matteo Scandolo297eb262017-05-15 17:00:53 -070031fi
32
33# activate the virtual env
34if [ ! $VIRTUAL_ENV ]; then
Matteo Scandolo9b849eb2017-09-14 13:44:33 -070035 source $BASEDIR/$VENVDIR/bin/activate
36 echo "Virtualenv activated."
Matteo Scandolo297eb262017-05-15 17:00:53 -070037fi
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 && \
Matteo Scandolo0e852b92018-04-03 14:33:06 -070051
52#install xos-genx
53cd $BASEDIR/lib/xos-genx; python setup.py install && \
54
55#install xos-util
56cd $BASEDIR/lib/xos-util; python setup.py install
Matteo Scandolo9b849eb2017-09-14 13:44:33 -070057 then
58 echo "Requirements installed."
59 echo "Virtualenv ready"
60 else
61 echo "An error occurred"
Matteo Scandolo297eb262017-05-15 17:00:53 -070062fi
Matteo Scandolo56879722017-05-17 21:39:54 -070063cd $BASEDIR