Skip to content
Snippets Groups Projects
Commit 2f5cbf0c authored by Antoine Lambert's avatar Antoine Lambert
Browse files

Makefile: Speedup sphinx-apidoc execution significantly

Previously the file patterns that sphinx-apidoc must exclude, stored
in the APIDOC_EXCLUDES variables, were expanded by the shell before
executing the tool resulting in a really long list of files to exclude.
Each time a file was processed by sphinx-apidoc, its path was compared
against that long list of files which was significantly slowing down
the apidoc generation process.

So ensure file exclude patterns are quoted to avoid shell expansion
and greatly speedup sphinx-apidoc execution.
parent 65edd83b
No related branches found
No related tags found
1 merge request!262Makefile: Speedup sphinx-apidoc execution significantly
......@@ -10,10 +10,11 @@ SPHINX_BUILDDIR = _build
SPHINX_SRCDIR = .
# relative to docs/ dir. Hence "." exclude the docs/ dir itself
APIDOC_EXCLUDES = . ../setup.py ../conftest.py ../swh/*/conftest.py
APIDOC_EXCLUDES += ../swh/*/tests ../swh/*/tests/* ../swh/*/*/tests/* ../swh/*/*/*/tests/*
APIDOC_EXCLUDES += ../swh/*/migrations ../swh/*/migrations/* ../swh/*/*/migrations/* ../swh/*/*/*/migrations/*
APIDOC_EXCLUDES += ../bin ../dist ../utils ../node_modules
APIDOC_EXCLUDES = conftest.py setup.py
APIDOC_EXCLUDES += */tests/* */migrations/* */wsgi.py */conftest.py
APIDOC_EXCLUDES += deposit/settings/* web/settings/* dataset/*
APIDOC_EXCLUDES += bin build dist utils node_modules
APIDOC_SWH_EXCLUDES = $(patsubst %,"../%",$(APIDOC_EXCLUDES))
html: sphinx/html
help: sphinx/help
......@@ -27,13 +28,13 @@ apidoc_dep = apidoc-stamp
endif
sphinx/clean:
$(SPHINXBUILD) -M clean $(SPHINX_SRCDIR) $(SPHINX_BUILDDIR) $(SPHINXOPTS)
$(SPHINXBUILD) -M clean $(SPHINX_SRCDIR) $(SPHINX_BUILDDIR) $(SPHINX_OPTS)
sphinx/%: $(apidoc_dep)
$(SPHINXBUILD) -b $* $(SPHINX_SRCDIR) $(SPHINX_BUILDDIR)/$* $(SPHINXOPTS)
$(SPHINXBUILD) -b $* $(SPHINX_SRCDIR) $(SPHINX_BUILDDIR)/$* $(SPHINX_OPTS)
apidoc: $(apidoc_dep)
apidoc-stamp:
$(SPHINXAPIDOC) $(APIDOC_OPTS) -o $(APIDOC_DIR) .. $(APIDOC_EXCLUDES)
$(SPHINXAPIDOC) $(APIDOC_OPTS) -o $(APIDOC_DIR) .. $(APIDOC_SWH_EXCLUDES)
# to silent Sphinx warnings about apidoc documents not included in any toctree
find $(shell pwd)/apidoc -name "*.rst" | xargs sed -i '1i:orphan:\n'
touch $@
......
......@@ -14,12 +14,9 @@ INSTALL_PERMS = g+rwX
SPHINXAPIDOC = sphinx-apidoc
APIDOC_DIR = apidoc
APIDOC_OPTS = --ext-viewcode --separate --no-toc
APIDOC_EXCLUDES = */tests */tests/* */*/tests/* */*/*/tests/*
APIDOC_EXCLUDES += */migrations */migrations/* */*/migrations/* */*/*/migrations/*
APIDOC_EXCLUDES += */wsgi.py */*/wsgi.py */*/*/wsgi.py
APIDOC_EXCLUDES += */conftest.py */*/conftest.py */*/*/conftest.py
APIDOC_EXCLUDES = */tests */migrations */wsgi.py */conftest.py */setup.py
APIDOC_EXCLUDES += deposit/settings/* web/settings/* dataset/*
APIDOC_SWH_EXCLUDES = $(patsubst %,$(SWHPKGDIR)/%,$(APIDOC_EXCLUDES))
APIDOC_SWH_EXCLUDES = $(patsubst %,"$(SWHPKGDIR)/%",$(APIDOC_EXCLUDES))
html: sphinx/html
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment