[Lldb-commits] [PATCH] D98441: [lldb] Fix the man page build

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 11 10:52:03 PST 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG75f97cdafe52: [lldb] Fix the man page build (authored by teemperor).
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98441/new/

https://reviews.llvm.org/D98441

Files:
  lldb/docs/conf.py


Index: lldb/docs/conf.py
===================================================================
--- lldb/docs/conf.py
+++ lldb/docs/conf.py
@@ -15,16 +15,21 @@
 import sys, os, re
 from datetime import date
 
-# If extensions (or modules to document with autodoc) are in another directory,
-# add these directories to sys.path here. If the directory is relative to the
-# documentation root, use os.path.abspath to make it absolute, like shown here.
-
-# Add the current directory that contains the mock _lldb native module which
-# is imported by the `lldb` module.
-sys.path.insert(0, os.path.abspath("."))
-# Add the build directory that contains the `lldb` module. LLDB_SWIG_MODULE is
-# set by CMake.
-sys.path.insert(0, os.getenv("LLDB_SWIG_MODULE"))
+building_man_page = tags.has('builder-man')
+
+# For the website we need to setup the path to the generated LLDB module that
+# we can generate documentation for its API.
+if not building_man_page:
+    # If extensions (or modules to document with autodoc) are in another directory,
+    # add these directories to sys.path here. If the directory is relative to the
+    # documentation root, use os.path.abspath to make it absolute, like shown here.
+
+    # Add the current directory that contains the mock _lldb native module which
+    # is imported by the `lldb` module.
+    sys.path.insert(0, os.path.abspath("."))
+    # Add the build directory that contains the `lldb` module. LLDB_SWIG_MODULE is
+    # set by CMake.
+    sys.path.insert(0, os.getenv("LLDB_SWIG_MODULE"))
 
 # Put the generated Python API documentation in the 'python_api' folder. This
 # also defines the URL these files will have in the generated website.
@@ -37,8 +42,12 @@
 
 # Add any Sphinx extension module names here, as strings. They can be extensions
 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['sphinx.ext.todo', 'sphinx.ext.mathjax', 'sphinx.ext.intersphinx',
-              'sphinx_automodapi.automodapi']
+extensions = ['sphinx.ext.todo', 'sphinx.ext.mathjax', 'sphinx.ext.intersphinx']
+
+# Unless we only generate the basic manpage we need the plugin for generating
+# the Python API documentation.
+if not building_man_page:
+    extensions.append('sphinx_automodapi.automodapi')
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
@@ -52,7 +61,7 @@
   import recommonmark
 except ImportError:
   # manpages do not use any .md sources
-  if not tags.has('builder-man'):
+  if not building_man_page:
     raise
 else:
   import sphinx
@@ -97,7 +106,12 @@
 # List of patterns, relative to source directory, that match files and
 # directories to ignore when looking for source files.
 exclude_patterns = ['_build', 'analyzer']
-
+# Ignore the generated Python documentation that is only used on the website.
+# Without this we will get a lot of warnings about doc pages that aren't
+# included by any doctree (as the manpage ignores those pages but they are
+# potentially still around from a previous website generation).
+if building_man_page:
+    exclude_patterns.append(automodapi_toctreedirnm)
 # Use the recommended 'any' rule so that referencing SB API classes is possible
 # by just writing `SBData`.
 default_role = 'any'


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98441.330028.patch
Type: text/x-patch
Size: 3273 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210311/6b50981d/attachment-0001.bin>


More information about the lldb-commits mailing list