Skip to content

Commit

Permalink
[Docs] Allow building man pages without myst_parser (#82402)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cor3ntin authored Mar 4, 2024
1 parent 00e4a41 commit 7d55a3b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
11 changes: 10 additions & 1 deletion clang/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
13 changes: 12 additions & 1 deletion flang/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion llvm/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7d55a3b

Please sign in to comment.