diff options
author | Sayed Adel <seiko@imavr.com> | 2021-08-31 16:41:07 +0200 |
---|---|---|
committer | Sayed Adel <seiko@imavr.com> | 2021-08-31 18:16:31 +0200 |
commit | defd9fe389fda06b940cf4b186ea25f7047fd294 (patch) | |
tree | 94c86d26e608f2be355cad9a3552df7fbf759c72 | |
parent | 21c69689bafc4ed2d3ef4038bda81d32c05dc6d7 (diff) | |
download | numpy-defd9fe389fda06b940cf4b186ea25f7047fd294.tar.gz |
DOC: skip generating c/c++ doc from comment blocks when Doxygen or Breathe isn't available.
-rw-r--r-- | doc/Makefile | 4 | ||||
-rw-r--r-- | doc/source/conf.py | 12 |
2 files changed, 15 insertions, 1 deletions
diff --git a/doc/Makefile b/doc/Makefile index 760e16038..16fc3229d 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -178,7 +178,11 @@ html: version-check html-build html-build: generate mkdir -p build/html build/doctrees $(PYTHON) preprocess.py +ifeq (, $(shell which $(DOXYGEN))) + @echo "Unable to find 'Doxygen:$(DOXYGEN)', skip generating C/C++ API from comment blocks." +else $(DOXYGEN) build/doxygen/Doxyfile +endif $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html $(FILES) $(PYTHON) postprocess.py html build/html/*.html @echo diff --git a/doc/source/conf.py b/doc/source/conf.py index 835ad9064..d08f29e59 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -2,6 +2,7 @@ import os import re import sys +import importlib # Minimum version, enforced by sphinx needs_sphinx = '3.2.0' @@ -84,9 +85,18 @@ extensions = [ 'IPython.sphinxext.ipython_console_highlighting', 'IPython.sphinxext.ipython_directive', 'sphinx.ext.mathjax', - 'breathe' ] +skippable_extensions = [ + ('breathe', 'skip generating C/C++ API from comment blocks.'), +] +for ext, warn in skippable_extensions: + ext_exist = importlib.util.find_spec(ext) is not None + if ext_exist: + extensions.append(ext) + else: + print(f"Unable to find Sphinx extension '{ext}', {warn}.") + # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] |