diff options
author | Peter Bandzi <pbandzi@cisco.com> | 2015-05-06 09:42:46 +0200 |
---|---|---|
committer | Peter Bandzi <pbandzi@cisco.com> | 2015-05-06 09:54:48 +0200 |
commit | bc49f02d832f2bf3d2e835583c1b8e3420fa4329 (patch) | |
tree | de3dac576728f49f721e5537729871cdaa10af8d /testcases/Controllers/ODL/CI/create_venv.sh | |
parent | 1c9672d21d592ef88c53d5836e3d575872d4b9bd (diff) |
Script for creating virtual environment added.
Plus start_test script fixes
JIRA: FUNCTEST-5
Change-Id: I015e3d8bfa7311437ca702f97c79d9e0bf3684ea
Signed-off-by: Peter Bandzi <pbandzi@cisco.com>
Diffstat (limited to 'testcases/Controllers/ODL/CI/create_venv.sh')
-rw-r--r-- | testcases/Controllers/ODL/CI/create_venv.sh | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/testcases/Controllers/ODL/CI/create_venv.sh b/testcases/Controllers/ODL/CI/create_venv.sh new file mode 100644 index 000000000..5d0733a5a --- /dev/null +++ b/testcases/Controllers/ODL/CI/create_venv.sh @@ -0,0 +1,35 @@ +#!/bin/bash -e + +# Script checks that venv exists. If it doesn't it will be created +# It requires python2.7 and virtualenv packages installed + +BASEDIR=`dirname $0` + +function venv_install() { + if command -v virtualenv-2.7; then + virtualenv-2.7 $1 + elif command -v virtualenv2; then + virtualenv2 $1 + elif command -v virtualenv; then + virtualenv $1 + else + echo Please make sure virtualenv package is installed. + return 1 + fi +} + +# exit when something goes wrong during venv install +set -e +if [ ! -d "$BASEDIR/venv" ]; then + venv_install $BASEDIR/venv + echo "Virtualenv created." +fi + +if [ ! -f "$BASEDIR/venv/updated" -o $BASEDIR/requirements.pip -nt $BASEDIR/venv/updated ]; then + source $BASEDIR/venv/bin/activate + pip install -r $BASEDIR/requirements.pip + touch $BASEDIR/venv/updated + echo "Requirements installed." + deactivate +fi +set +e |