Skip to content

Instantly share code, notes, and snippets.

@dakcarto
Created May 7, 2014 14:36
Show Gist options
  • Save dakcarto/f166cdc1135c5d34c673 to your computer and use it in GitHub Desktop.
Save dakcarto/f166cdc1135c5d34c673 to your computer and use it in GitHub Desktop.
Script to build just en PyQGIS docs for QGIS-Documentation repo
#!/bin/bash
# Build just PyQGIS docs HTML and for only locale 'en'
QGISDOCS="/Users/larrys/QGIS/github.com/QGIS-Documentation"
GITPATCH="/Users/larrys/Dropbox-Personal/Dropbox/QGIS/patches/pyqgis-docs-conf-patch.diff"
STATICLINK="${QGISDOCS}/source/static"
BUILDDIR="${QGISDOCS}/build"
HTMLDIR="${QGISDOCS}/output/html/en"
export PATH=$PATH:/usr/local/bin:/usr/local/sbin
CLEANUP () {
echo "Cleaning build env..."
if [ -e "${STATICLINK}" ]; then
rm -f "${STATICLINK}"
fi
# if [ -d "${BUILDDIR}" ]; then
# rm -rf "${BUILDDIR}"
# fi
git apply --check --reverse "${GITPATCH}" 2>/dev/null
if [ $? -eq 0 ]; then
echo "Reversing patch to conf.py..."
git apply --reverse "${GITPATCH}"
if [ $? -gt 0 ]; then
echo "ERROR reversing patch to conf.py!"
exit 1
fi
fi
}
cd "${QGISDOCS}"
echo ""
# clean up previous leftovers, if failed
CLEANUP
# set up build and output dir
echo "Setting up build env..."
mkdir -p "${BUILDDIR}"
mkdir -p "${HTMLDIR}"
# link in static resources
ln -s ../resources/en/docs "${STATICLINK}"
# patch conf.py to ignore other doc trees
git apply --check "${GITPATCH}"
if [ $? -eq 0 ]; then
echo "Applying patch to conf.py..."
git apply "${GITPATCH}"
if [ $? -gt 0 ]; then
echo "ERROR applying patch to conf.py!"
exit 1
fi
fi
echo "Building just PyQGIS docs HTML for locale 'en'..."
sphinx-build -d "${BUILDDIR}/doctrees" -D language=en -b html source "${HTMLDIR}"
# clean up
CLEANUP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment