1 # -*- coding: utf-8 -*-
3 # LLDB documentation build configuration file, created by
4 # sphinx-quickstart on Sun Dec 9 20:01:55 2012.
6 # This file is execfile()d with the current directory set to its containing dir.
8 # Note that not all possible configuration values are present in this
11 # All configuration values have a default; values that are commented out
12 # serve to show the default.
13 import sys
, os
, re
, shutil
14 from datetime
import date
16 building_man_page
= tags
.has("builder-man")
18 # For the website we need to setup the path to the generated LLDB module that
19 # we can generate documentation for its API.
20 if not building_man_page
:
21 # If extensions (or modules to document with autodoc) are in another directory,
22 # add these directories to sys.path here. If the directory is relative to the
23 # documentation root, use os.path.abspath to make it absolute, like shown here.
25 # Add the current directory that contains the mock _lldb native module which
26 # is imported by the `lldb` module.
27 sys
.path
.insert(0, os
.path
.abspath("."))
28 # Add the build directory that contains the `lldb` module. LLDB_SWIG_MODULE is
30 sys
.path
.insert(0, os
.getenv("LLDB_SWIG_MODULE"))
32 # Put the generated Python API documentation in the 'python_api' folder. This
33 # also defines the URL these files will have in the generated website.
34 automodapi_toctreedirnm
= "python_api"
36 # -- General configuration -----------------------------------------------------
38 # If your documentation needs a minimal Sphinx version, state it here.
39 # needs_sphinx = '1.0'
41 # Add any Sphinx extension module names here, as strings. They can be extensions
42 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
43 extensions
= ["sphinx.ext.todo", "sphinx.ext.mathjax", "sphinx.ext.intersphinx"]
45 autodoc_default_options
= {"special-members": True}
47 # Unless we only generate the basic manpage we need the plugin for generating
48 # the Python API documentation.
49 if not building_man_page
:
51 import sphinx_automodapi
.automodapi
52 except ModuleNotFoundError
:
54 f
"install sphinx_automodapi with {sys.executable} -m pip install sphinx_automodapi"
56 extensions
.append("sphinx_automodapi.automodapi")
60 except ModuleNotFoundError
:
61 print(f
"install sphinx furo theme with {sys.executable} -m pip install furo")
62 # The theme to use for HTML and HTML Help pages. See the documentation for
63 # a list of builtin themes.
66 # Add any paths that contain templates here, relative to this directory.
67 templates_path
= ["_templates"]
69 # The suffix of source filenames.
71 ".rst": "restructuredtext",
74 # The encoding of source files.
75 # source_encoding = 'utf-8-sig'
77 # The master toctree document.
80 # General information about the project.
82 copyright
= "2007-%d, The LLDB Team" % date
.today().year
84 # The version info for the project you're documenting, acts as replacement for
85 # |version| and |release|, also used in various other places throughout the
86 # built documents. These are currently set to zero because we don't use them.
87 # Should somebody consider in the future to change them, they need to be updated
88 # everytime a new release comes out.
92 # The full version, including alpha/beta/rc tags.
95 # The language for content autogenerated by Sphinx. Refer to documentation
96 # for a list of supported languages.
99 # There are two options for replacing |today|: either, you set today to some
100 # non-false value, then it is used:
102 # Else, today_fmt is used as the format for a strftime call.
103 # today_fmt = '%B %d, %Y'
105 # List of patterns, relative to source directory, that match files and
106 # directories to ignore when looking for source files.
107 exclude_patterns
= ["_build", "analyzer"]
108 # Ignore the generated Python documentation that is only used on the website.
109 # Without this we will get a lot of warnings about doc pages that aren't
110 # included by any doctree (as the manpage ignores those pages but they are
111 # potentially still around from a previous website generation).
112 if building_man_page
:
113 exclude_patterns
.append(automodapi_toctreedirnm
)
114 # Use the recommended 'any' rule so that referencing SB API classes is possible
115 # by just writing `SBData`.
118 # If true, '()' will be appended to :func: etc. cross-reference text.
119 # add_function_parentheses = True
121 # If true, the current module name will be prepended to all description
122 # unit titles (such as .. function::).
123 # add_module_names = True
125 # If true, sectionauthor and moduleauthor directives will be shown in the
126 # output. They are ignored by default.
127 # show_authors = False
129 # The name of the Pygments (syntax highlighting) style to use.
130 pygments_style
= "friendly"
132 # A list of ignored prefixes for module index sorting.
133 # modindex_common_prefix = []
136 # -- Options for HTML output ---------------------------------------------------
138 # The theme to use for HTML and HTML Help pages. See the documentation for
139 # a list of builtin themes.
142 # Theme options are theme-specific and customize the look and feel of a theme
143 # further. For a list of options available for each theme, see the
145 html_theme_options
= {}
147 # Add any paths that contain custom themes here, relative to this directory.
148 # html_theme_path = []
150 # The name for this set of Sphinx documents. If None, it defaults to
151 # "<project> v<release> documentation".
152 html_title
= "🐛 LLDB"
154 # A shorter title for the navigation bar. Default is the same as html_title.
155 # html_short_title = None
157 # The name of an image file (relative to this directory) to place at the top
161 # The name of an image file (within the static path) to use as favicon of the
162 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
164 # html_favicon = None
166 # Add any paths that contain custom static files (such as style sheets) here,
167 # relative to this directory. They are copied after the builtin static files,
168 # so a file named "default.css" will overwrite the builtin "default.css".
169 # html_static_path = ["_static"]
171 html_extra_path
= [".htaccess"]
173 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
174 # using the given strftime format.
175 html_last_updated_fmt
= "%b %d, %Y"
177 # If true, SmartyPants will be used to convert quotes and dashes to
178 # typographically correct entities.
179 # html_use_smartypants = True
181 # Custom sidebar templates, maps document names to template names.
184 # Additional templates that should be rendered to pages, maps page names to
186 # html_additional_pages = {}
188 # If false, no module index is generated.
189 # html_domain_indices = True
191 # If false, no index is generated.
192 # html_use_index = True
194 # If true, the index is split into individual pages for each letter.
195 # html_split_index = False
197 # If true, links to the reST sources are added to the pages.
198 # html_show_sourcelink = True
200 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
201 # html_show_sphinx = True
203 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
204 # html_show_copyright = True
206 # If true, an OpenSearch description file will be output, and all pages will
207 # contain a <link> tag referring to it. The value of this option must be the
208 # base URL from which the finished HTML is served.
209 # html_use_opensearch = ''
211 # This is the file name suffix for HTML files (e.g. ".xhtml").
212 # html_file_suffix = None
214 # Output file base name for HTML help builder.
215 htmlhelp_basename
= "LLDBdoc"
217 # If true, the reST sources are included in the HTML build as
218 # _sources/name. The default is True.
219 html_copy_source
= False
221 # -- Options for LaTeX output --------------------------------------------------
224 # The paper size ('letterpaper' or 'a4paper').
225 #'papersize': 'letterpaper',
226 # The font size ('10pt', '11pt' or '12pt').
227 #'pointsize': '10pt',
228 # Additional stuff for the LaTeX preamble.
232 # Grouping the document tree into LaTeX files. List of tuples
233 # (source start file, target name, title, author, documentclass [howto/manual]).
235 ("index", "LLDB.tex", "LLDB Documentation", "The LLDB Team", "manual"),
238 # The name of an image file (relative to this directory) to place at the top of
242 # For "manual" documents, if this is true, then toplevel headings are parts,
244 # latex_use_parts = False
246 # If true, show page references after internal links.
247 # latex_show_pagerefs = False
249 # If true, show URL addresses after external links.
250 # latex_show_urls = False
252 # Documents to append as an appendix to all manuals.
253 # latex_appendices = []
255 # If false, no module index is generated.
256 # latex_domain_indices = True
259 # -- Options for manual page output --------------------------------------------
261 # One entry per manual page. List of tuples
262 # (source start file, name, description, authors, manual section).
264 ("man/lldb", "lldb", "LLDB Documentation", ["LLVM project"], 1),
265 ("man/lldb-server", "lldb-server", "LLDB Documentation", ["LLVM project"], 1),
268 # If true, show URL addresses after external links.
269 # man_show_urls = False
271 # -- Options for Texinfo output ------------------------------------------------
273 # Grouping the document tree into Texinfo files. List of tuples
274 # (source start file, target name, title, author,
275 # dir menu entry, description, category)
276 texinfo_documents
= [
280 "LLDB Documentation",
283 "One line description of project.",
288 # Documents to append as an appendix to all manuals.
289 # texinfo_appendices = []
291 # If false, no module index is generated.
292 # texinfo_domain_indices = True
294 # How to display URL addresses: 'footnote', 'no', or 'inline'.
295 # texinfo_show_urls = 'footnote'
297 empty_attr_summary
= re
.compile(
298 r
"\.\. rubric:: Attributes Summary\s*\.\. autosummary::\s*\.\. rubric::"
300 empty_attr_documentation
= re
.compile(
301 r
"\.\. rubric:: Attributes Documentation\s*\.\. rubric::"
305 def preprocess_source(app
, docname
, source
):
306 """Preprocesses source files generated by automodapi."""
307 # Don't cleanup anything beside automodapi-generated sources.
308 if not automodapi_toctreedirnm
in docname
:
310 processed
= source
[0]
312 # Don't show the list of inheritance info as there is no inheritance in the
313 # SBI API. This avoids all the repeated text on all doc pages that a
314 # class inherits from 'object'.
316 processed
= processed
.replace(":show-inheritance:", "")
317 # Remove the SWIG generated 'thisown' attribute. It just bloats the generated
318 # documentation and users shouldn't fiddle with the value anyway.
319 processed
= re
.sub(r
"~SB[a-zA-Z]+\.thisown", "", processed
)
320 processed
= processed
.replace(" .. autoattribute:: thisown", "")
322 # After removing 'thisown', many objects don't have any attributes left.
323 # Remove all now empty attribute summary/documentation sections with
324 # some rather ugly regex.
325 processed
= empty_attr_summary
.sub(".. rubric::", processed
)
326 processed
= empty_attr_documentation
.sub(".. rubric::", processed
)
328 # Replace the original source with the processed one (source is a single
330 source
[0] = processed
333 def cleanup_source(app
, exception
):
334 """Remove files generated by automodapi in the source tree."""
335 if hasattr(app
.config
, "automodapi_toctreedirnm"):
336 api_source_dir
= os
.path
.join(app
.srcdir
, app
.config
.automodapi_toctreedirnm
)
337 shutil
.rmtree(api_source_dir
, ignore_errors
=True)
341 app
.connect("source-read", preprocess_source
)
342 app
.connect("build-finished", cleanup_source
)