diff --git a/maharadocs-1.7/debian/maharadocs.postinst b/maharadocs-1.7/debian/maharadocs.postinst index 5d888f213c476863243f2436c4dec9c8d3e1e951..d244f27337a8036454361c17feeaf7a6e8b752e0 100644 --- a/maharadocs-1.7/debian/maharadocs.postinst +++ b/maharadocs-1.7/debian/maharadocs.postinst @@ -24,6 +24,21 @@ case "$1" in ;; 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 # but better than no check :D @@ -36,6 +51,10 @@ then # packaging do its thing. echo "Data already exists pulling from the correct source." echo "Not doing any alteration of $DIRNAME." + + # Update the Python virtual environment first, though + update_venv + exit else # However if it looks wrong, check if its a-ok to overwrite @@ -85,20 +104,8 @@ else exit -1 fi -# Set up the Python virtual environment - -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 +# Update the Python virtual environment +update_venv # Make the sitelogs directory... mkdir -p /var/log/sitelogs/mahara-manual-sphinx