summaryrefslogtreecommitdiff
path: root/doc/source/conf.py
diff options
context:
space:
mode:
authorSayed Adel <seiko@imavr.com>2021-08-31 16:41:07 +0200
committerSayed Adel <seiko@imavr.com>2021-08-31 18:16:31 +0200
commitdefd9fe389fda06b940cf4b186ea25f7047fd294 (patch)
tree94c86d26e608f2be355cad9a3552df7fbf759c72 /doc/source/conf.py
parent21c69689bafc4ed2d3ef4038bda81d32c05dc6d7 (diff)
downloadnumpy-defd9fe389fda06b940cf4b186ea25f7047fd294.tar.gz
DOC: skip generating c/c++ doc from comment blocks when Doxygen or Breathe isn't available.
Diffstat (limited to 'doc/source/conf.py')
-rw-r--r--doc/source/conf.py12
1 files changed, 11 insertions, 1 deletions
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']