Fix: doc/bindings/python/Makefile.am: run the `sphinx` Python 3 package
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 7 Jun 2019 15:13:35 +0000 (11:13 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 8 Jun 2019 00:38:02 +0000 (20:38 -0400)
In `sphinx-build.py` (removed), importing `main` and `make_main` from
the `sphinx` package is not considered stable: it used to work for me,
but now it doesn't (cannot import). Instead, run the `sphinx` package
directly with the Python interpreter's `-m` option.

We do this instead of running `sphinx-build` directly because we want to
pick Sphinx for Python 3 (because we're importing the `bt2` package for
autodoc), not for Python 2, and the installed `sphinx-build` program can
be the one for Python 2 on some distributions.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I158dbb96a8b3a26db67dd6e16254a64ac9d24446
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1401

doc/bindings/python/Makefile.am
doc/bindings/python/sphinx-build.py [deleted file]

index e12ed58917fe1ba0b17ddde9d3fd1a6b1c602ad1..aa94c271112c4c118b186102dfaf77b70f098bd0 100644 (file)
@@ -5,21 +5,21 @@ SPHINX_BUILD_DIRHTML_DIR = $(SPHINX_BUILD_DIR)/dirhtml
 SPHINX_HTML_TARGET = $(SPHINX_BUILD_HTML_DIR)/index.html
 SPHINX_DIRHTML_TARGET = $(SPHINX_BUILD_DIRHTML_DIR)/index.html
 
-EXTRA_DIST = $(srcdir)/source $(srcdir)/sphinx-build.py
+EXTRA_DIST = $(srcdir)/source
 
 all-local: $(SPHINX_HTML_TARGET) $(SPHINX_DIRHTML_TARGET)
 
 PYTHON_BT2_BUILD_LIB_DIR = $(abs_top_builddir)/bindings/python/bt2/build/build_lib
 PP = $(PYTHON_BT2_BUILD_LIB_DIR)
 LLP = $(abs_top_builddir)/lib/.libs
-LOCAL_SPHINXBUILD = PYTHONPATH="$(PP)" LD_LIBRARY_PATH="$(LLP)" $(PYTHON) $(srcdir)/sphinx-build.py
+SPHINXBUILD = PYTHONPATH="$(PP)" LD_LIBRARY_PATH="$(LLP)" $(PYTHON) -m sphinx
 SPHINX_SRC = $(wildcard $(SPHINX_SOURCE_DIR)/*.rst)
 
 $(SPHINX_HTML_TARGET): $(SPHINX_SRC)
-       $(LOCAL_SPHINXBUILD) -b html -E $(SPHINX_SOURCE_DIR) $(SPHINX_BUILD_HTML_DIR)
+       $(SPHINXBUILD) -b html -E $(SPHINX_SOURCE_DIR) $(SPHINX_BUILD_HTML_DIR)
 
 $(SPHINX_DIRHTML_TARGET): $(SPHINX_SRC)
-       $(LOCAL_SPHINXBUILD) -b dirhtml -E $(SPHINX_SOURCE_DIR) $(SPHINX_BUILD_DIRHTML_DIR)
+       $(SPHINXBUILD) -b dirhtml -E $(SPHINX_SOURCE_DIR) $(SPHINX_BUILD_DIRHTML_DIR)
 
 clean-local:
        rm -rf $(SPHINX_BUILD_DIR)
diff --git a/doc/bindings/python/sphinx-build.py b/doc/bindings/python/sphinx-build.py
deleted file mode 100644 (file)
index 0ab5733..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/env python
-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))
This page took 0.025726 seconds and 4 git commands to generate.