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:-.} |
Zack Williams | be5ee1c | 2019-03-18 15:33:07 -0700 | [diff] [blame] | 24 | PIP_REQS=${PIP_REQS:-${XOS_DIR}/containers/xos/requirements.txt} |
Zack Williams | b4a75d1 | 2018-07-12 15:34:03 -0700 | [diff] [blame] | 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 |
Scott Baker | 2f8e180 | 2019-03-20 13:38:46 -0700 | [diff] [blame] | 37 | pip install -r "$PIP_REQS" nose2 mock requests_mock |
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 | 73a1285 | 2018-09-05 15:33:35 -0700 | [diff] [blame] | 49 | pushd "$XOS_DIR/lib/xos-genx" |
Zack Williams | b4a75d1 | 2018-07-12 15:34:03 -0700 | [diff] [blame] | 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 | 73a1285 | 2018-09-05 15:33:35 -0700 | [diff] [blame] | 54 | pushd "$XOS_DIR/lib/xos-kafka" |
| 55 | python setup.py install |
| 56 | echo "xos-kafka Installed" |
| 57 | popd |
| 58 | |
Scott Baker | dbd3a33 | 2019-01-28 10:19:18 -0800 | [diff] [blame] | 59 | pushd "$XOS_DIR/lib/xos-api" |
Scott Baker | bef5fd9 | 2019-02-21 10:24:02 -0800 | [diff] [blame] | 60 | python setup.py install |
Scott Baker | dbd3a33 | 2019-01-28 10:19:18 -0800 | [diff] [blame] | 61 | echo "xos-api Installed" |
Zack Williams | b4a75d1 | 2018-07-12 15:34:03 -0700 | [diff] [blame] | 62 | popd |
| 63 | |
Scott Baker | 69a5330 | 2019-02-01 11:34:18 -0800 | [diff] [blame] | 64 | pushd "$XOS_DIR/lib/xos-synchronizer" |
| 65 | python ./setup.py install |
| 66 | echo "xos-synchronizer Installed" |
| 67 | popd |
| 68 | |
Matteo Scandolo | 57fdb4b | 2019-02-06 18:27:56 -0800 | [diff] [blame] | 69 | pushd "$XOS_DIR/lib/xos-migrate" |
| 70 | python ./setup.py install |
| 71 | echo "xos-migrate Installed" |
| 72 | popd |
| 73 | |
Scott Baker | 69a5330 | 2019-02-01 11:34:18 -0800 | [diff] [blame] | 74 | |
Zack Williams | b4a75d1 | 2018-07-12 15:34:03 -0700 | [diff] [blame] | 75 | echo "XOS dev/test virtualenv created. Run 'source ${VENVDIR}/bin/activate'." |