2017-08-07 19:07:58 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
BASEDIR=`dirname $0`/..
|
|
|
|
|
2017-08-10 14:35:11 -04:00
|
|
|
if [ ! -d "$BASEDIR/zulip-api-py2-venv" ]; then
|
|
|
|
virtualenv $BASEDIR/zulip-api-py2-venv
|
2017-08-07 19:07:58 -04:00
|
|
|
echo "Virtualenv created."
|
|
|
|
fi
|
|
|
|
|
2017-08-10 14:35:11 -04:00
|
|
|
source $BASEDIR/zulip-api-py2-venv/bin/activate
|
|
|
|
RVAL=$?
|
|
|
|
if [ $RVAL -ne 0 ]; then
|
|
|
|
echo "Failed to activate virtualenv."
|
|
|
|
exit
|
|
|
|
fi
|
2017-08-07 19:07:58 -04:00
|
|
|
|
2017-08-10 14:35:11 -04:00
|
|
|
# Install python dependencies if needed.
|
|
|
|
cmp $BASEDIR/zulip-api-py2-venv/installed-requirements.txt requirements.txt 2>/dev/null
|
|
|
|
RVAL=$? # Return value of the comparision. 0 means files are same.
|
|
|
|
if [ $RVAL -ne 0 ]; then
|
2017-08-07 19:07:58 -04:00
|
|
|
pip install -r $BASEDIR/requirements.txt
|
2017-08-10 14:35:11 -04:00
|
|
|
cp requirements.txt $BASEDIR/zulip-api-py2-venv/installed-requirements.txt
|
2017-08-07 19:07:58 -04:00
|
|
|
echo "Requirements installed."
|
|
|
|
fi
|