https://github.com/cor3ntin updated https://github.com/llvm/llvm-project/pull/82402
>From 0cb108fa6552b112d5eeb9b82e4f57711fac4a35 Mon Sep 17 00:00:00 2001 From: Corentin Jabot <corentinja...@gmail.com> Date: Tue, 20 Feb 2024 19:44:06 +0100 Subject: [PATCH 1/2] [Docs] Allow building man pages without myst_parser 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. --- clang/docs/conf.py | 12 ++++++++++-- flang/docs/conf.py | 12 +++++++++++- llvm/docs/conf.py | 12 +++++++++++- 3 files changed, 32 insertions(+), 4 deletions(-) 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 >From f7b8b4e7735eff63bb413ba2ff9e36b5aac9dbc8 Mon Sep 17 00:00:00 2001 From: Corentin Jabot <corentinja...@gmail.com> Date: Mon, 4 Mar 2024 12:33:35 +0100 Subject: [PATCH 2/2] Run darker --- clang/docs/conf.py | 9 +++++---- flang/docs/conf.py | 9 +++++---- llvm/docs/conf.py | 9 +++++---- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/clang/docs/conf.py b/clang/docs/conf.py index 44fd743dc0173f..3c373c4b255118 100644 --- a/clang/docs/conf.py +++ b/clang/docs/conf.py @@ -39,11 +39,12 @@ # 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") + import myst_parser + + extensions.append("myst_parser") except ImportError: - if not tags.has("builder-man"): - raise + if not tags.has("builder-man"): + raise # The encoding of source files. diff --git a/flang/docs/conf.py b/flang/docs/conf.py index 121c8f34a1ec61..48f7b69f5d7505 100644 --- a/flang/docs/conf.py +++ b/flang/docs/conf.py @@ -32,11 +32,12 @@ # 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") + import myst_parser + + extensions.append("myst_parser") except ImportError: - if not tags.has("builder-man"): - raise + if not tags.has("builder-man"): + raise # Add any paths that contain templates here, relative to this directory. diff --git a/llvm/docs/conf.py b/llvm/docs/conf.py index 54e45badff79df..acbddc7b2f12b4 100644 --- a/llvm/docs/conf.py +++ b/llvm/docs/conf.py @@ -32,11 +32,12 @@ # 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") + import myst_parser + + extensions.append("myst_parser") except ImportError: - if not tags.has("builder-man"): - raise + if not tags.has("builder-man"): + raise # Automatic anchors for markdown titles from llvm_slug import make_slug _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits