[clang] [flang] [llvm] [Docs] Allow building man pages without myst_parser (PR #82402)

via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 20 10:49:08 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: cor3ntin (cor3ntin)

<details>
<summary>Changes</summary>

The pan 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.

---
Full diff: https://github.com/llvm/llvm-project/pull/82402.diff


3 Files Affected:

- (modified) clang/docs/conf.py (+10-2) 
- (modified) flang/docs/conf.py (+11-1) 
- (modified) llvm/docs/conf.py (+11-1) 


``````````diff
diff --git a/clang/docs/conf.py b/clang/docs/conf.py
index 31a4daa39d5b8e..44fd743dc0173f 100644
--- a/clang/docs/conf.py
+++ b/clang/docs/conf.py
@@ -35,8 +35,16 @@
 
 import sphinx
 
-if sphinx.version_info >= (3, 0):
-    extensions.append("myst_parser")
+# 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..121c8f34a1ec61 100644
--- a/flang/docs/conf.py
+++ b/flang/docs/conf.py
@@ -22,13 +22,23 @@
 # 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..54e45badff79df 100644
--- a/llvm/docs/conf.py
+++ b/llvm/docs/conf.py
@@ -26,7 +26,17 @@
 
 # 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

``````````

</details>


https://github.com/llvm/llvm-project/pull/82402


More information about the cfe-commits mailing list