[clang] 7d55a3b - [Docs] Allow building man pages without myst_parser (#82402)

via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 4 04:31:32 PST 2024


Author: cor3ntin
Date: 2024-03-04T13:31:26+01:00
New Revision: 7d55a3ba92368be55b392c20d623fde6ac82d86d

URL: https://github.com/llvm/llvm-project/commit/7d55a3ba92368be55b392c20d623fde6ac82d86d
DIFF: https://github.com/llvm/llvm-project/commit/7d55a3ba92368be55b392c20d623fde6ac82d86d.diff

LOG: [Docs] Allow building man pages without myst_parser (#82402)

The man pages do not depend on the doc present in markdown files, so
they can be built without myst_parser.
Doing so might allow llvm distributions to have less development
dependencies.

As we do not have the ennvironment to test these configuration, this
capability is provided on a best-effort basis.

This restores a capability accidentally lost in #65664.

Added: 
    

Modified: 
    clang/docs/conf.py
    flang/docs/conf.py
    llvm/docs/conf.py

Removed: 
    


################################################################################
diff  --git a/clang/docs/conf.py b/clang/docs/conf.py
index 31a4daa39d5b8e..3c373c4b255118 100644
--- a/clang/docs/conf.py
+++ b/clang/docs/conf.py
@@ -35,8 +35,17 @@
 
 import sphinx
 
-if sphinx.version_info >= (3, 0):
+# When building man pages, we do not use the markdown pages,
+# So, we can continue without the myst_parser dependencies.
+# Doing so reduces dependencies of some packaged llvm distributions.
+try:
+    import myst_parser
+
     extensions.append("myst_parser")
+except ImportError:
+    if not tags.has("builder-man"):
+        raise
+
 
 # The encoding of source files.
 # source_encoding = 'utf-8-sig'

diff  --git a/flang/docs/conf.py b/flang/docs/conf.py
index a34f7bf4a2100b..48f7b69f5d7505 100644
--- a/flang/docs/conf.py
+++ b/flang/docs/conf.py
@@ -22,13 +22,24 @@
 # Add any Sphinx extension module names here, as strings. They can be extensions
 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
 extensions = [
-    "myst_parser",
     "sphinx.ext.todo",
     "sphinx.ext.mathjax",
     "sphinx.ext.intersphinx",
     "sphinx.ext.autodoc",
 ]
 
+# When building man pages, we do not use the markdown pages,
+# So, we can continue without the myst_parser dependencies.
+# Doing so reduces dependencies of some packaged llvm distributions.
+try:
+    import myst_parser
+
+    extensions.append("myst_parser")
+except ImportError:
+    if not tags.has("builder-man"):
+        raise
+
+
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ["_templates"]
 myst_heading_anchors = 6

diff  --git a/llvm/docs/conf.py b/llvm/docs/conf.py
index 0a3905201c8592..acbddc7b2f12b4 100644
--- a/llvm/docs/conf.py
+++ b/llvm/docs/conf.py
@@ -26,7 +26,18 @@
 
 # Add any Sphinx extension module names here, as strings. They can be extensions
 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ["myst_parser", "sphinx.ext.intersphinx", "sphinx.ext.todo"]
+extensions = ["sphinx.ext.intersphinx", "sphinx.ext.todo"]
+
+# When building man pages, we do not use the markdown pages,
+# So, we can continue without the myst_parser dependencies.
+# Doing so reduces dependencies of some packaged llvm distributions.
+try:
+    import myst_parser
+
+    extensions.append("myst_parser")
+except ImportError:
+    if not tags.has("builder-man"):
+        raise
 
 # Automatic anchors for markdown titles
 from llvm_slug import make_slug


        


More information about the cfe-commits mailing list