diff options
author | drebs <drebs@riseup.net> | 2017-10-11 08:19:02 -0300 |
---|---|---|
committer | drebs <drebs@riseup.net> | 2017-10-11 08:19:02 -0300 |
commit | 080e59ed7c74e7a31ef2bc8c75000b0081837f3a (patch) | |
tree | a15195007eae7d37cabbbfe402ae7ebabc1019e7 | |
parent | 5a6d04ca38736440e67b202a909b386fb0ba830d (diff) |
[doc] add script to build docs
-rw-r--r-- | Makefile | 6 | ||||
-rwxr-xr-x | scripts/docs/build-soledad-doc.sh | 47 |
2 files changed, 53 insertions, 0 deletions
@@ -3,3 +3,9 @@ default: upload_packages: python setup.py sdist bdist_wheel --universal upload --sign -i $(MAINTAINER) -r pypi + +docs: + (cd docs && make html) + +docs-using-virtualenv: + ./scripts/docs/build-soledad-doc.sh diff --git a/scripts/docs/build-soledad-doc.sh b/scripts/docs/build-soledad-doc.sh new file mode 100755 index 00000000..ee4e8bd0 --- /dev/null +++ b/scripts/docs/build-soledad-doc.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +# This script builds the Soledad documentation using a virtual environment. +# You can pass the target directory as the first command line argument: +# +# ./build-soledad-doc.sh [target-dir] +# +# If you no directory is passed, documentation will be built on the default +# place used by sphinx: <repodir>/docs/_build + +set -eu +set -o xtrace + +BUILDDIR=${1:-_build} +REPO="http://0xacab.org/leap/soledad" +REPO=/tmp/soledad +TEMPDIR=$(mktemp -d) +VENVDIR=${TEMPDIR}/venv +REPODIR=${TEMPDIR}/soledad +TARGET=html + +if [[ ${BUILDDIR} = /* ]]; then + type="absolute" + docdir=${BUILDDIR}/${TARGET} +else + type="relative" + docdir=${REPODIR}/docs/${BUILDDIR}/${TARGET} +fi + +echo "Documentation will be written to ${type} path ${BUILDDIR}." + +# build and activate the virtual environment +if [ ! -d ${VENVDIR} ]; then + virtualenv ${VENVDIR} +fi +. ${VENVDIR}/bin/activate + +# clone the canonical repository +git clone ${REPO} ${REPODIR} + +# install deps +pip install -U pip wheel +pip install -r ${REPODIR}/docs/requirements.pip + +# build documentation +make -C ${REPODIR}/docs ${TARGET} BUILDDIR=${BUILDDIR} +ls -1 ${docdir} |