-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Docs] Allow building man pages without myst_parser #82402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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 llvm#65664.
@llvm/pr-subscribers-clang Author: cor3ntin (cor3ntin) ChangesThe pan pages do not depend on the doc present in markdown files, so they can be built without myst_parser. 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:
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
|
✅ With the latest revision this PR passed the Python code formatter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes look reasonable to me, but I'd appreciate a final sign off from @mgorny to make sure this works for his needs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. From a quick test run with and without myst-parser
, this seems to work as intended.
clang/docs/conf.py
Outdated
# So, we can continue without the myst_parser dependencies. | ||
# Doing so reduces dependencies of some packaged llvm distributions. | ||
try: | ||
import myst_parser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're using different indentation (2 spaces) vs other code in that file (4 spaces).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM aside from the formatting issue @mgorny mentioned.
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.