[ -z "$vdir" ] && vdir="./virtualenv"
if [ ! -e $vdir ]; then
- virtualenv --no-site-packages $vdir
+ virtualenv --system-site-packages $vdir
+fi
+$vdir/bin/pip install -r ../admin/doc-requirements.txt
+
+sphinx_build="$vdir/bin/sphinx-build"
+if [ ! -e $sphinx_build ]; then
+ # If sphinx is not installed inside the virtualenv (that is, we
+ # have a system-wide sphinx installed and it is new enough), use
+ # that. As we need to use the python interpreter from inside the
+ # virtualenv to make the sphinx extensions visible, we need need
+ # to know the full path to the sphinx-build script.
+ sphinx_build="$(command -v -p sphinx-build)"
fi
-$vdir/bin/pip install --quiet -r ../admin/doc-requirements.txt
install -d -m0755 \
output/html \
output/man
-PYTHONPATH=`pwd`/../src/pybind $vdir/bin/sphinx-build -a -b dirhtml -d doctrees ../doc output/html
-$vdir/bin/sphinx-build -a -b man -d doctrees ../doc output/man
+PYTHONPATH="$(pwd)/../src/pybind" "$vdir/bin/python" "$sphinx_build" -a -b dirhtml -d doctrees ../doc output/html
+"$vdir/bin/python" "$sphinx_build" -a -b man -d doctrees ../doc output/man