3 # Script checks that venv exists. If it doesn't it will be created
4 # It requires python2.7 and virtualenv packages installed
8 function venv_install() {
9 if command -v virtualenv-2.7; then
10 virtualenv-2.7 -p python2.7 $1
11 elif command -v virtualenv2; then
12 virtualenv2 -p python2.7 $1
13 elif command -v virtualenv; then
14 virtualenv -p python2.7 $1
16 echo Cannot find virtualenv command.
21 # exit when something goes wrong during venv install
23 if [ ! -d "$BASEDIR/venv" ]; then
24 venv_install $BASEDIR/venv
25 echo "Virtualenv created."
28 if [[ ! $(rpm -qa | grep python-2.7) ]]; then
29 echo "Python 2.7 not found, but required...attempting to install"
30 sudo yum install -y python-2.7*
33 if [ ! -f "$BASEDIR/venv/updated" -o $BASEDIR/requirements.pip -nt $BASEDIR/venv/updated ]; then
34 source $BASEDIR/venv/bin/activate
35 pip install -r $BASEDIR/requirements.pip
36 touch $BASEDIR/venv/updated
37 echo "Requirements installed."