blob: ac912aae4c0499fc8e2f32ba2fe9012b5496ae1a [file] [log] [blame]
Zack Williamsb4a75d12018-07-12 15:34:03 -07001#!/usr/bin/env bash
Matteo Scandolo297eb262017-05-15 17:00:53 -07002
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
Zack Williamsb4a75d12018-07-12 15:34:03 -070017# setup_venv_lite.sh
18# sets up a python virtualenv for testing and service development
Matteo Scandolo297eb262017-05-15 17:00:53 -070019
Zack Williamsb4a75d12018-07-12 15:34:03 -070020set -e -o pipefail
21
22WORKSPACE=${WORKSPACE:-.}
23XOS_DIR=${XOS_DIR:-.}
Zack Williamsbe5ee1c2019-03-18 15:33:07 -070024PIP_REQS=${PIP_REQS:-${XOS_DIR}/containers/xos/requirements.txt}
Zack Williamsb4a75d12018-07-12 15:34:03 -070025VENVDIR="${WORKSPACE}/venv-xos"
Matteo Scandolo297eb262017-05-15 17:00:53 -070026
27# create venv if it's not yet there
Zack Williamsb4a75d12018-07-12 15:34:03 -070028if [ ! -x "${VENVDIR}/bin/activate" ]; then
29 echo "Setting up dev/test virtualenv in ${VENVDIR} for XOS"
30 virtualenv -q "${VENVDIR}" --no-site-packages
31 echo "Virtualenv created."
Matteo Scandolo297eb262017-05-15 17:00:53 -070032fi
33
Zack Williamsb4a75d12018-07-12 15:34:03 -070034echo "Installing python requirements in virtualenv with pip"
35source "${VENVDIR}/bin/activate"
36pip install --upgrade pip
Scott Baker2f8e1802019-03-20 13:38:46 -070037pip install -r "$PIP_REQS" nose2 mock requests_mock
Matteo Scandolo297eb262017-05-15 17:00:53 -070038
Zack Williamsb4a75d12018-07-12 15:34:03 -070039pushd "$XOS_DIR/lib/xos-util"
40python setup.py install
41echo "xos-util Installed"
42popd
Matteo Scandolo67654fa2017-06-09 09:33:17 -070043
Zack Williamsb4a75d12018-07-12 15:34:03 -070044pushd "$XOS_DIR/lib/xos-config"
45python setup.py install
46echo "xos-config Installed"
47popd
Matteo Scandolo0e852b92018-04-03 14:33:06 -070048
Zack Williams73a12852018-09-05 15:33:35 -070049pushd "$XOS_DIR/lib/xos-genx"
Zack Williamsb4a75d12018-07-12 15:34:03 -070050python setup.py install
51echo "xos-genx Installed"
52popd
Matteo Scandolo0e852b92018-04-03 14:33:06 -070053
Zack Williams73a12852018-09-05 15:33:35 -070054pushd "$XOS_DIR/lib/xos-kafka"
55python setup.py install
56echo "xos-kafka Installed"
57popd
58
Scott Bakerdbd3a332019-01-28 10:19:18 -080059pushd "$XOS_DIR/lib/xos-api"
Scott Bakerbef5fd92019-02-21 10:24:02 -080060python setup.py install
Scott Bakerdbd3a332019-01-28 10:19:18 -080061echo "xos-api Installed"
Zack Williamsb4a75d12018-07-12 15:34:03 -070062popd
63
Scott Baker69a53302019-02-01 11:34:18 -080064pushd "$XOS_DIR/lib/xos-synchronizer"
65python ./setup.py install
66echo "xos-synchronizer Installed"
67popd
68
Matteo Scandolo57fdb4b2019-02-06 18:27:56 -080069pushd "$XOS_DIR/lib/xos-migrate"
70python ./setup.py install
71echo "xos-migrate Installed"
72popd
73
Scott Baker69a53302019-02-01 11:34:18 -080074
Zack Williamsb4a75d12018-07-12 15:34:03 -070075echo "XOS dev/test virtualenv created. Run 'source ${VENVDIR}/bin/activate'."