Commit 456b2d54 authored by Kristina Hoeppner's avatar Kristina Hoeppner

Merge branch 'virtualenv' into 'master'

Virtualenv

This change makes the cron jobs check for the existence of a Python virtual environment, set up in a `venv` directory. If there is no virtual environment, the cron job will fail with an error and a message to stdout (which should end up in someone's root@ server mailbox somewhere). This environment should be set up when the Debian package is updated to a new version (in postinst).

**Note:** before this package is installed, the mahara manual directory should be checked out to the latest `16.10_STABLE` branch which should contain the `requirements.txt` file, which is required for the postinst to correctly install the virtual environment.

See merge request !2
parents afcadb2e 51e2b855
......@@ -11,6 +11,6 @@ Homepage: manual.mahara.org
Package: maharadocs
Architecture: all
Pre-depends: debconf (>= 0.2.17)
Depends: ${misc:Depends}, python-sphinx, apache2, gettext, git-core, bzr, make, ttf-wqy-microhei, ttf-freefont, mendexk, texlive-latex-extra, texlive-fonts-recommended, texlive-latex-recommended, texlive-xetex, ttf-indic-fonts-core, texlive-lang-all, python-pybabel, imagemagick
Depends: ${misc:Depends}, python-sphinx, apache2, gettext, git-core, bzr, make, ttf-wqy-microhei, ttf-freefont, mendexk, texlive-latex-extra, texlive-fonts-recommended, texlive-latex-recommended, texlive-xetex, ttf-indic-fonts-core, texlive-lang-all, python-pybabel, imagemagick, python-virtualenv
Description: localised automated sphinx docs for Mahara
This package installs the automated localised sphinx docs for Mahara to the webroot
......@@ -17,6 +17,12 @@ echo ==================================== >> $LOGFILE
date '+%Y-%m-%d %H:%M:%S %Z' >> $LOGFILE
echo ==================================== >> $LOGFILE
if [ ! -d venv ]; then
echo "This needs to run in the Python virtual environment. See README.md for instructions."
exit 1
fi
. venv/bin/activate
git pull >> $LOGFILE
# Move old versions to the monthly cron in /etc/cron.monthly/
......
......@@ -18,6 +18,12 @@ echo Monthly run >> $LOGFILE
date '+%Y-%m-%d %H:%M:%S %Z' >> $LOGFILE
echo ==================================== >> $LOGFILE
if [ ! -d venv ]; then
echo "This needs to run in the Python virtual environment. See README.md for instructions."
exit 1
fi
. venv/bin/activate
git pull >> $LOGFILE
make -C $INSTALLDIR update html epub MAHARA=1.4 >> $LOGFILE 2>&1
......
......@@ -80,6 +80,21 @@ 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
# Make the sitelogs directory...
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