Zack Williams | b4a75d1 | 2018-07-12 15:34:03 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Matteo Scandolo | 297eb26 | 2017-05-15 17:00:53 -0700 | [diff] [blame] | 2 | |
Matteo Scandolo | d2044a4 | 2017-08-07 16:08:28 -0700 | [diff] [blame] | 3 | # 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 Williams | b4a75d1 | 2018-07-12 15:34:03 -0700 | [diff] [blame] | 17 | # setup_venv_lite.sh |
| 18 | # sets up a python virtualenv for testing and service development |
Matteo Scandolo | 297eb26 | 2017-05-15 17:00:53 -0700 | [diff] [blame] | 19 | |
Zack Williams | b4a75d1 | 2018-07-12 15:34:03 -0700 | [diff] [blame] | 20 | set -e -o pipefail |
| 21 | |
| 22 | WORKSPACE=${WORKSPACE:-.} |
| 23 | XOS_DIR=${XOS_DIR:-.} |
| 24 | PIP_REQS=${PIP_REQS:-${XOS_DIR}/scripts/xos_dev_reqs.txt} |
| 25 | VENVDIR="${WORKSPACE}/venv-xos" |
Matteo Scandolo | 297eb26 | 2017-05-15 17:00:53 -0700 | [diff] [blame] | 26 | |
| 27 | # create venv if it's not yet there |
Zack Williams | b4a75d1 | 2018-07-12 15:34:03 -0700 | [diff] [blame] | 28 | if [ ! -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 Scandolo | 297eb26 | 2017-05-15 17:00:53 -0700 | [diff] [blame] | 32 | fi |
| 33 | |
Zack Williams | b4a75d1 | 2018-07-12 15:34:03 -0700 | [diff] [blame] | 34 | echo "Installing python requirements in virtualenv with pip" |
| 35 | source "${VENVDIR}/bin/activate" |
| 36 | pip install --upgrade pip |
| 37 | pip install -r "$PIP_REQS" |
Matteo Scandolo | 297eb26 | 2017-05-15 17:00:53 -0700 | [diff] [blame] | 38 | |
Zack Williams | b4a75d1 | 2018-07-12 15:34:03 -0700 | [diff] [blame] | 39 | pushd "$XOS_DIR/lib/xos-util" |
| 40 | python setup.py install |
| 41 | echo "xos-util Installed" |
| 42 | popd |
Matteo Scandolo | 67654fa | 2017-06-09 09:33:17 -0700 | [diff] [blame] | 43 | |
Zack Williams | b4a75d1 | 2018-07-12 15:34:03 -0700 | [diff] [blame] | 44 | pushd "$XOS_DIR/lib/xos-config" |
| 45 | python setup.py install |
| 46 | echo "xos-config Installed" |
| 47 | popd |
Matteo Scandolo | 0e852b9 | 2018-04-03 14:33:06 -0700 | [diff] [blame] | 48 | |
Zack Williams | b4a75d1 | 2018-07-12 15:34:03 -0700 | [diff] [blame] | 49 | pushd "$XOS_DIR//lib/xos-genx" |
| 50 | python setup.py install |
| 51 | echo "xos-genx Installed" |
| 52 | popd |
Matteo Scandolo | 0e852b9 | 2018-04-03 14:33:06 -0700 | [diff] [blame] | 53 | |
Zack Williams | b4a75d1 | 2018-07-12 15:34:03 -0700 | [diff] [blame] | 54 | pushd "$XOS_DIR/xos/xos_client" |
| 55 | make |
| 56 | echo "xos-client Installed" |
| 57 | popd |
| 58 | |
| 59 | echo "XOS dev/test virtualenv created. Run 'source ${VENVDIR}/bin/activate'." |