Skip to content

Instantly share code, notes, and snippets.

@jaylett
Last active August 29, 2015 14:02
Show Gist options
  • Select an option

  • Save jaylett/9e083e3be73d45f9ce38 to your computer and use it in GitHub Desktop.

Select an option

Save jaylett/9e083e3be73d45f9ce38 to your computer and use it in GitHub Desktop.
Find sphinx-build in configure, and explicitly invoke under python2 or python3 as required
diff --git a/xapian-bindings/configure.ac b/xapian-bindings/configure.ac
index 89b3f8c..c9c316d 100644
--- a/xapian-bindings/configure.ac
+++ b/xapian-bindings/configure.ac
@@ -483,6 +483,15 @@ if test x$USE_MAINTAINER_MODE = xyes; then
test -z "$PYTHON" && AC_MSG_ERROR([python is required in maintainer mode])
fi
+dnl If we're building documentation for either python version,
+dnl we need sphinx-build
+case $enable_documentation$with_python$with_python3 in
+yes*yes*)
+ AC_PATH_PROG(SPHINX_BUILD, sphinx-build, [])
+ test -z "$SPHINX_BUILD" && AC_MSG_ERROR([sphinx-build is required to build python documentation])
+ ;;
+esac
+
if test no != "$with_php" ; then
dnl See comment for AC_PATH_PROGS(SWIG, ...).
AC_PATH_PROGS(PHP_CONFIG, ["${PHP_CONFIG-php-config}"], [])
diff --git a/xapian-bindings/python/Makefile.am b/xapian-bindings/python/Makefile.am
index a838cd8..e4cfe78 100644
--- a/xapian-bindings/python/Makefile.am
+++ b/xapian-bindings/python/Makefile.am
@@ -158,7 +158,7 @@ dist-hook: $(sphinxdocs)
cp -R -p docs/html $(distdir)/docs
$(sphinxdocs): xapian/__init__.py docs/conf.py $(srcdir)/docs/*.rst $(dist_exampledata_DATA)
- PYTHONPATH=..:$$PYTHONPATH sphinx-build -b html -d doctrees -c docs $(srcdir)/docs docs/html
+ PYTHONPATH=..:$$PYTHONPATH $(PYTHON2) $(SPHINX_BUILD) -b html -d doctrees -c docs $(srcdir)/docs docs/html
@echo
@echo "Build finished. The HTML pages are in docs/html."
endif
diff --git a/xapian-bindings/python3/Makefile.am b/xapian-bindings/python3/Makefile.am
index c2aa3f0..75ba433 100755
--- a/xapian-bindings/python3/Makefile.am
+++ b/xapian-bindings/python3/Makefile.am
@@ -162,10 +162,8 @@ dist-hook: $(sphinxdocs)
test -d $(distdir)/docs || mkdir $(distdir)/docs
cp -R -p docs/html $(distdir)/docs
-SPHINX_BUILD = /usr/share/sphinx/scripts/python3/sphinx-build
-
$(sphinxdocs): xapian/__init__.py docs/conf.py $(srcdir)/docs/*.rst $(dist_exampledata_DATA)
- PYTHONPATH=..:$$PYTHONPATH $(SPHINX_BUILD) -b html -d doctrees -c docs $(srcdir)/docs docs/html
+ PYTHONPATH=..:$$PYTHONPATH $(PYTHON3) $(SPHINX_BUILD) -b html -d doctrees -c docs $(srcdir)/docs docs/html
@echo
@echo "Build finished. The HTML pages are in docs/html."
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment