pw_docgen: sphinxcontrib-mermaid workaround:
Version >=4.0.0 of Sphinx removes some APIs, one of which is used by
sphinxcontrib-mermaid. Error:
Running Sphinx v4.0.0
Extension error:
Could not import extension sphinxcontrib.mermaid (exception: cannot import name
'ENOENT' from 'sphinx.util.osutil'
Failed roll:
https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/44223
This workaround can be removed after
https://github.com/mgaitan/sphinxcontrib-mermaid/pull/71 is merged.
No-Docs-Update-Reason: Sphinx 4.0 workaround.
Change-Id: I63e192428dda4efa228dea892ef857c782ec5674
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/44320
Commit-Queue: Anthony DiGirolamo <tonymd@google.com>
Pigweed-Auto-Submit: Anthony DiGirolamo <tonymd@google.com>
Reviewed-by: Rob Mohr <mohrr@google.com>
diff --git a/docs/conf.py b/docs/conf.py
index b7bbda8..0791a4e 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -13,8 +13,17 @@
# the License.
"""Pigweed's Sphinx configuration."""
+import sphinx
import sphinx_rtd_theme
+# TODO(pwbug/376): Remove this when this PR is merged:
+# https://github.com/mgaitan/sphinxcontrib-mermaid/pull/71
+# Needed for sphinxcontrib-mermaid compatibility with sphinx 4.0.0.
+if sphinx.version_info[0] >= 4:
+ import errno
+ import sphinx.util.osutil
+ sphinx.util.osutil.ENOENT = errno.ENOENT
+
# The suffix of source filenames.
source_suffix = ['.rst']