Skip to content

Commit 7d55a3b

Browse files
authored
[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.
1 parent 00e4a41 commit 7d55a3b

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

clang/docs/conf.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,17 @@
3535

3636
import sphinx
3737

38-
if sphinx.version_info >= (3, 0):
38+
# When building man pages, we do not use the markdown pages,
39+
# So, we can continue without the myst_parser dependencies.
40+
# Doing so reduces dependencies of some packaged llvm distributions.
41+
try:
42+
import myst_parser
43+
3944
extensions.append("myst_parser")
45+
except ImportError:
46+
if not tags.has("builder-man"):
47+
raise
48+
4049

4150
# The encoding of source files.
4251
# source_encoding = 'utf-8-sig'

flang/docs/conf.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,24 @@
2222
# Add any Sphinx extension module names here, as strings. They can be extensions
2323
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
2424
extensions = [
25-
"myst_parser",
2625
"sphinx.ext.todo",
2726
"sphinx.ext.mathjax",
2827
"sphinx.ext.intersphinx",
2928
"sphinx.ext.autodoc",
3029
]
3130

31+
# When building man pages, we do not use the markdown pages,
32+
# So, we can continue without the myst_parser dependencies.
33+
# Doing so reduces dependencies of some packaged llvm distributions.
34+
try:
35+
import myst_parser
36+
37+
extensions.append("myst_parser")
38+
except ImportError:
39+
if not tags.has("builder-man"):
40+
raise
41+
42+
3243
# Add any paths that contain templates here, relative to this directory.
3344
templates_path = ["_templates"]
3445
myst_heading_anchors = 6

llvm/docs/conf.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,18 @@
2626

2727
# Add any Sphinx extension module names here, as strings. They can be extensions
2828
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
29-
extensions = ["myst_parser", "sphinx.ext.intersphinx", "sphinx.ext.todo"]
29+
extensions = ["sphinx.ext.intersphinx", "sphinx.ext.todo"]
30+
31+
# When building man pages, we do not use the markdown pages,
32+
# So, we can continue without the myst_parser dependencies.
33+
# Doing so reduces dependencies of some packaged llvm distributions.
34+
try:
35+
import myst_parser
36+
37+
extensions.append("myst_parser")
38+
except ImportError:
39+
if not tags.has("builder-man"):
40+
raise
3041

3142
# Automatic anchors for markdown titles
3243
from llvm_slug import make_slug

0 commit comments

Comments
 (0)