Skip to content

Commit

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

0 comments on commit 0cb108f

Please sign in to comment.