Commit 5d86df6d authored by Jonathan Harker's avatar Jonathan Harker

Update the Python environment at the appropriate junctures.

parent 12e0f077
...@@ -24,6 +24,21 @@ case "$1" in ...@@ -24,6 +24,21 @@ case "$1" in
;; ;;
esac esac
function update_venv {
echo "Updating Python virtual environment:"
# If the Python virtual environment doesn't exist, try creating it.
if [ ! -d $DIRNAME/venv ]; then
echo "Virtual environment missing, creating a new one."
virtualenv $DIRNAME/venv || \
echo "${bold}*** ERROR: failed to create a virtual environment in $DIRNAME/venv${normal}"
fi
echo "${bold}Updating Python virtual environment...${normal}"
. $DIRNAME/venv/bin/activate
pip install --upgrade -r $DIRNAME/requirements.txt || \
echo "${bold}*** ERROR: pip install failed, you may need to use a wheelhouse.${normal}"
deactivate
}
# Check if we seem to have the correct git contents, not very trustworthy # Check if we seem to have the correct git contents, not very trustworthy
# but better than no check :D # but better than no check :D
...@@ -36,6 +51,10 @@ then ...@@ -36,6 +51,10 @@ then
# packaging do its thing. # packaging do its thing.
echo "Data already exists pulling from the correct source." echo "Data already exists pulling from the correct source."
echo "Not doing any alteration of $DIRNAME." echo "Not doing any alteration of $DIRNAME."
# Update the Python virtual environment first, though
update_venv
exit exit
else else
# However if it looks wrong, check if its a-ok to overwrite # However if it looks wrong, check if its a-ok to overwrite
...@@ -85,20 +104,8 @@ else ...@@ -85,20 +104,8 @@ else
exit -1 exit -1
fi fi
# Set up the Python virtual environment # Update the Python virtual environment
update_venv
if [ -d $DIRNAME/venv ]
then
echo "Python virtual environment already exists, skipping."
else
echo "${bold}Setting up Python virtual environment...${normal}"
# TODO: If this fails, see README about installing from the wheelhouse.
virtualenv $DIRNAME/venv
. $DIRNAME/venv/bin/activate
pip install -r $DIRNAME/requirements.txt || \
echo "${bold}*** ERROR: pip install failed, you may need to use a wheelhouse.${normal}"
deactivate
fi
# Make the sitelogs directory... # Make the sitelogs directory...
mkdir -p /var/log/sitelogs/mahara-manual-sphinx mkdir -p /var/log/sitelogs/mahara-manual-sphinx
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment