blob: feab72a6d6e1cb8381cfc230c6c52d1dbbcd4bdc [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:-.}
24PIP_REQS=${PIP_REQS:-${XOS_DIR}/scripts/xos_dev_reqs.txt}
25VENVDIR="${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
37pip install -r "$PIP_REQS"
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
Zack Williamsb4a75d12018-07-12 15:34:03 -070059pushd "$XOS_DIR/xos/xos_client"
60make
61echo "xos-client Installed"
62popd
63
64echo "XOS dev/test virtualenv created. Run 'source ${VENVDIR}/bin/activate'."