X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=utils%2Flab-reconfiguration%2Fcreate_venv.sh;h=4e7144c7000552f2b99839f6894ee034d7eb2d4f;hb=3292d24b1d4944bb18f43488eb4a6b1ca76f1be8;hp=19d9b49c4a555a11b94f5b2dae473b4df4e46a30;hpb=2beb18fbd56e7474e6da103634ce1feb697a4965;p=releng.git diff --git a/utils/lab-reconfiguration/create_venv.sh b/utils/lab-reconfiguration/create_venv.sh index 19d9b49c4..4e7144c70 100755 --- a/utils/lab-reconfiguration/create_venv.sh +++ b/utils/lab-reconfiguration/create_venv.sh @@ -1,5 +1,12 @@ #!/bin/bash -e - +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2016 Cisco and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## # Script checks that venv exists. If it doesn't it will be created # It requires python2.7 and virtualenv packages installed @@ -7,11 +14,11 @@ BASEDIR=`dirname $0` function venv_install() { if command -v virtualenv-2.7; then - virtualenv-2.7 $1 + virtualenv-2.7 -p python2.7 $1 elif command -v virtualenv2; then - virtualenv2 $1 + virtualenv2 -p python2.7 $1 elif command -v virtualenv; then - virtualenv $1 + virtualenv -p python2.7 $1 else echo Cannot find virtualenv command. return 1 @@ -25,6 +32,11 @@ if [ ! -d "$BASEDIR/venv" ]; then echo "Virtualenv created." fi +if [[ ! $(rpm -qa | grep python-2.7) ]]; then + echo "Python 2.7 not found, but required...attempting to install" + sudo yum install -y python-2.7* +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