From 969a2d51aef4796c802ddc35804f25132a0bf2ef Mon Sep 17 00:00:00 2001 From: Pierre-Luc St-Charles Date: Wed, 17 Oct 2018 16:31:37 -0400 Subject: [PATCH] Move docs autoapi call to config.py setup --- Makefile | 1 - docs/src/conf.py | 13 +++++++++++++ tox.ini | 1 - 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ce5a65f..e5680a6 100644 --- a/Makefile +++ b/Makefile @@ -134,7 +134,6 @@ coverage: .PHONY: docs docs: install-docs @bash -c "source $(CONDA_HOME)/bin/activate $(CONDA_ENV); \ - $(CUR_DIR)/docs/sphinx "apidoc" -o $(CUR_DIR)/docs/src $(CUR_DIR)/src; \ $(MAKE) -C $(CUR_DIR)/docs clean; \ $(MAKE) -C $(CUR_DIR)/docs html;" $(BROWSER) $(CUR_DIR)/docs/build/html/index.html diff --git a/docs/src/conf.py b/docs/src/conf.py index 1049226..e2c0cba 100644 --- a/docs/src/conf.py +++ b/docs/src/conf.py @@ -55,5 +55,18 @@ def skip(app, what, name, obj, skip, options): return False return skip +def run_apidoc(_): + argv = ["-o", "./src/", "../src/"] + try: + # Sphinx 1.7+ + from sphinx.ext import apidoc + apidoc.main(argv) + except ImportError: + # Sphinx 1.6 (and earlier) + from sphinx import apidoc + argv.insert(0, apidoc.__file__) + apidoc.main(argv) + def setup(app): app.connect("autodoc-skip-member", skip) + app.connect("builder-inited", run_apidoc) diff --git a/tox.ini b/tox.ini index 1921225..a35040a 100644 --- a/tox.ini +++ b/tox.ini @@ -62,7 +62,6 @@ deps = -r{toxinidir}/docs/requirements.txt whitelist_externals = make commands = - python docs/sphinx apidoc -o docs/src src make -C docs clean make -C docs html