summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAndrew Leeming <andrew.leeming@codethink.co.uk>2016-12-08 17:02:11 +0000
committerAndrew Leeming <andrew.leeming@codethink.co.uk>2017-01-04 09:12:03 +0000
commit3a57675ddd53da852a1cf94af169ba8a1f2fb7dc (patch)
treec970028a41a9e17948b797dd2e361c56e57a35ce /doc
parentdfd6a6599b2b9886dca68de5300283fc3d78fb00 (diff)
downloadbuildstream-3a57675ddd53da852a1cf94af169ba8a1f2fb7dc.tar.gz
Sphinx to not assume python3 is the default python version
Adding in experimental makefile and sphinx script to explicitly run using python3 instead of assuming the python command points to a python3.x binary
Diffstat (limited to 'doc')
-rw-r--r--doc/Makefile18
-rwxr-xr-xdoc/sphinx-build315
2 files changed, 33 insertions, 0 deletions
diff --git a/doc/Makefile b/doc/Makefile
index d06c004fa..70e0ced95 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -14,6 +14,21 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) sou
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
+# Fix for when python is mapped to python2 not python3
+# This is an issue in the sphinx-build script provided in the default install
+# because it uses the generic python env, so we need to have a copy of this script
+# but with an explicit call to python3.
+#
+# Why python3? We are using some features of sphinx that are only implemented
+# currently in python3
+#
+PYV=$(shell python -c "import sys;t='{v[0]}'.format(v=list(sys.version_info[:2]));sys.stdout.write(t)")
+
+ifeq ($(PYV), 2)
+ SPHINXBUILD = ./sphinx-build3
+endif
+
+
all: docs
# Canned recipe for generating plugin api skeletons
@@ -65,3 +80,6 @@ docs: apidoc
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+testy:
+ @echo "Using $(SPHINXBUILD)"
+ @echo "Py is $(PYV)"
diff --git a/doc/sphinx-build3 b/doc/sphinx-build3
new file mode 100755
index 000000000..590fd5266
--- /dev/null
+++ b/doc/sphinx-build3
@@ -0,0 +1,15 @@
+#!/usr/bin/python3
+# -*- coding: utf-8 -*-
+"""
+Same as /usr/bin/sphinx-build but with different
+interpreter
+"""
+
+import sys
+
+if __name__ == '__main__':
+ from sphinx import main, make_main
+ if sys.argv[1:2] == ['-M']:
+ sys.exit(make_main(sys.argv))
+ else:
+ sys.exit(main(sys.argv)) \ No newline at end of file