1# -*- coding: utf-8 -*- 2# 3# LLDB documentation build configuration file, created by 4# sphinx-quickstart on Sun Dec 9 20:01:55 2012. 5# 6# This file is execfile()d with the current directory set to its containing dir. 7# 8# Note that not all possible configuration values are present in this 9# autogenerated file. 10# 11# All configuration values have a default; values that are commented out 12# serve to show the default. 13from __future__ import print_function 14 15import sys, os, re 16from datetime import date 17 18building_man_page = tags.has('builder-man') 19 20# For the website we need to setup the path to the generated LLDB module that 21# we can generate documentation for its API. 22if not building_man_page: 23 # If extensions (or modules to document with autodoc) are in another directory, 24 # add these directories to sys.path here. If the directory is relative to the 25 # documentation root, use os.path.abspath to make it absolute, like shown here. 26 27 # Add the current directory that contains the mock _lldb native module which 28 # is imported by the `lldb` module. 29 sys.path.insert(0, os.path.abspath(".")) 30 # Add the build directory that contains the `lldb` module. LLDB_SWIG_MODULE is 31 # set by CMake. 32 sys.path.insert(0, os.getenv("LLDB_SWIG_MODULE")) 33 34# Put the generated Python API documentation in the 'python_api' folder. This 35# also defines the URL these files will have in the generated website. 36automodapi_toctreedirnm = 'python_api' 37 38# -- General configuration ----------------------------------------------------- 39 40# If your documentation needs a minimal Sphinx version, state it here. 41#needs_sphinx = '1.0' 42 43# Add any Sphinx extension module names here, as strings. They can be extensions 44# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 45extensions = ['sphinx.ext.todo', 'sphinx.ext.mathjax', 'sphinx.ext.intersphinx'] 46 47autodoc_default_options = { 48 'special-members': '__int__, __len__, __hex__, __oct__, __iter__', 49} 50 51# Unless we only generate the basic manpage we need the plugin for generating 52# the Python API documentation. 53if not building_man_page: 54 extensions.append('sphinx_automodapi.automodapi') 55 56# Add any paths that contain templates here, relative to this directory. 57templates_path = ['_templates'] 58 59# The suffix of source filenames. 60source_suffix = { 61 '.rst': 'restructuredtext', 62} 63 64try: 65 import recommonmark 66except ImportError: 67 # manpages do not use any .md sources 68 if not building_man_page: 69 raise 70else: 71 import sphinx 72 if sphinx.version_info >= (3, 0): 73 # This requires 0.5 or later. 74 extensions.append('recommonmark') 75 else: 76 source_parsers = {'.md': 'recommonmark.parser.CommonMarkParser'} 77 source_suffix['.md'] = 'markdown' 78 79# The encoding of source files. 80#source_encoding = 'utf-8-sig' 81 82# The master toctree document. 83master_doc = 'index' 84 85# General information about the project. 86project = u'LLDB' 87copyright = u'2007-%d, The LLDB Team' % date.today().year 88 89# The version info for the project you're documenting, acts as replacement for 90# |version| and |release|, also used in various other places throughout the 91# built documents. These are currently set to zero because we don't use them. 92# Should somebody consider in the future to change them, they need to be updated 93# everytime a new release comes out. 94# 95# The short version. 96#version = '0' 97# The full version, including alpha/beta/rc tags. 98#release = '0' 99 100# The language for content autogenerated by Sphinx. Refer to documentation 101# for a list of supported languages. 102#language = None 103 104# There are two options for replacing |today|: either, you set today to some 105# non-false value, then it is used: 106#today = '' 107# Else, today_fmt is used as the format for a strftime call. 108#today_fmt = '%B %d, %Y' 109 110# List of patterns, relative to source directory, that match files and 111# directories to ignore when looking for source files. 112exclude_patterns = ['_build', 'analyzer'] 113# Ignore the generated Python documentation that is only used on the website. 114# Without this we will get a lot of warnings about doc pages that aren't 115# included by any doctree (as the manpage ignores those pages but they are 116# potentially still around from a previous website generation). 117if building_man_page: 118 exclude_patterns.append(automodapi_toctreedirnm) 119# Use the recommended 'any' rule so that referencing SB API classes is possible 120# by just writing `SBData`. 121default_role = 'any' 122 123# If true, '()' will be appended to :func: etc. cross-reference text. 124#add_function_parentheses = True 125 126# If true, the current module name will be prepended to all description 127# unit titles (such as .. function::). 128#add_module_names = True 129 130# If true, sectionauthor and moduleauthor directives will be shown in the 131# output. They are ignored by default. 132#show_authors = False 133 134# The name of the Pygments (syntax highlighting) style to use. 135pygments_style = 'friendly' 136 137# A list of ignored prefixes for module index sorting. 138#modindex_common_prefix = [] 139 140 141# -- Options for HTML output --------------------------------------------------- 142 143# The theme to use for HTML and HTML Help pages. See the documentation for 144# a list of builtin themes. 145html_theme = 'alabaster' 146 147# Theme options are theme-specific and customize the look and feel of a theme 148# further. For a list of options available for each theme, see the 149# documentation. 150html_theme_options = { 151 'font_size': '11pt', 152 # Don't generate any links to GitHub. 153 'github_button' : 'false', 154} 155 156# Add any paths that contain custom themes here, relative to this directory. 157#html_theme_path = [] 158 159# The name for this set of Sphinx documents. If None, it defaults to 160# "<project> v<release> documentation". 161html_title = 'The LLDB Debugger' 162 163# A shorter title for the navigation bar. Default is the same as html_title. 164#html_short_title = None 165 166# The name of an image file (relative to this directory) to place at the top 167# of the sidebar. 168#html_logo = None 169 170# The name of an image file (within the static path) to use as favicon of the 171# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 172# pixels large. 173#html_favicon = None 174 175# Add any paths that contain custom static files (such as style sheets) here, 176# relative to this directory. They are copied after the builtin static files, 177# so a file named "default.css" will overwrite the builtin "default.css". 178html_static_path = ['_static'] 179 180html_context = { 181 'css_files': [ 182 '_static/lldb.css' 183 ], 184 } 185 186html_extra_path = ['.htaccess'] 187 188# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 189# using the given strftime format. 190html_last_updated_fmt = '%b %d, %Y' 191 192# If true, SmartyPants will be used to convert quotes and dashes to 193# typographically correct entities. 194#html_use_smartypants = True 195 196# Custom sidebar templates, maps document names to template names. 197#html_sidebars = {} 198 199# Additional templates that should be rendered to pages, maps page names to 200# template names. 201#html_additional_pages = {} 202 203# If false, no module index is generated. 204#html_domain_indices = True 205 206# If false, no index is generated. 207#html_use_index = True 208 209# If true, the index is split into individual pages for each letter. 210#html_split_index = False 211 212# If true, links to the reST sources are added to the pages. 213#html_show_sourcelink = True 214 215# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 216#html_show_sphinx = True 217 218# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 219#html_show_copyright = True 220 221# If true, an OpenSearch description file will be output, and all pages will 222# contain a <link> tag referring to it. The value of this option must be the 223# base URL from which the finished HTML is served. 224#html_use_opensearch = '' 225 226# This is the file name suffix for HTML files (e.g. ".xhtml"). 227#html_file_suffix = None 228 229# Output file base name for HTML help builder. 230htmlhelp_basename = 'LLDBdoc' 231 232# If true, the reST sources are included in the HTML build as 233# _sources/name. The default is True. 234html_copy_source = False 235 236# -- Options for LaTeX output -------------------------------------------------- 237 238latex_elements = { 239# The paper size ('letterpaper' or 'a4paper'). 240#'papersize': 'letterpaper', 241 242# The font size ('10pt', '11pt' or '12pt'). 243#'pointsize': '10pt', 244 245# Additional stuff for the LaTeX preamble. 246#'preamble': '', 247} 248 249# Grouping the document tree into LaTeX files. List of tuples 250# (source start file, target name, title, author, documentclass [howto/manual]). 251latex_documents = [ 252 ('index', 'LLDB.tex', u'LLDB Documentation', 253 u'The LLDB Team', 'manual'), 254] 255 256# The name of an image file (relative to this directory) to place at the top of 257# the title page. 258#latex_logo = None 259 260# For "manual" documents, if this is true, then toplevel headings are parts, 261# not chapters. 262#latex_use_parts = False 263 264# If true, show page references after internal links. 265#latex_show_pagerefs = False 266 267# If true, show URL addresses after external links. 268#latex_show_urls = False 269 270# Documents to append as an appendix to all manuals. 271#latex_appendices = [] 272 273# If false, no module index is generated. 274#latex_domain_indices = True 275 276 277# -- Options for manual page output -------------------------------------------- 278 279# One entry per manual page. List of tuples 280# (source start file, name, description, authors, manual section). 281man_pages = [('man/lldb', 'lldb', u'LLDB Documentation', [u'LLVM project'], 1), 282 ('man/lldb-server', 'lldb-server', u'LLDB Documentation', [u'LLVM project'], 1), 283 ] 284 285# If true, show URL addresses after external links. 286#man_show_urls = False 287 288def process_md(name): 289 file_subpath = os.path.join(command_guide_subpath, name) 290 with open(os.path.join(command_guide_path, name)) as f: 291 title = f.readline().rstrip('\n') 292 293 m = re.match(r'^# (\S+) - (.+)$', title) 294 if m is None: 295 print("error: invalid title in %r " 296 "(expected '# <name> - <description>')" % file_subpath, 297 file=sys.stderr) 298 else: 299 man_pages.append((file_subpath.replace('.md',''), m.group(1), 300 m.group(2), man_page_authors, 1)) 301 302# -- Options for Texinfo output ------------------------------------------------ 303 304# Grouping the document tree into Texinfo files. List of tuples 305# (source start file, target name, title, author, 306# dir menu entry, description, category) 307texinfo_documents = [ 308 ('index', 'LLDB', u'LLDB Documentation', 309 u'The LLDB Team', 'LLDB', 'One line description of project.', 310 'Miscellaneous'), 311] 312 313# Documents to append as an appendix to all manuals. 314#texinfo_appendices = [] 315 316# If false, no module index is generated. 317#texinfo_domain_indices = True 318 319# How to display URL addresses: 'footnote', 'no', or 'inline'. 320#texinfo_show_urls = 'footnote' 321 322empty_attr_summary = re.compile(r'\.\. rubric:: Attributes Summary\s*\.\. autosummary::\s*\.\. rubric::') 323empty_attr_documentation = re.compile(r'\.\. rubric:: Attributes Documentation\s*\.\. rubric::') 324 325def cleanup_source(app, docname, source): 326 """ Cleans up source files generated by automodapi. """ 327 # Don't cleanup anything beside automodapi-generated sources. 328 if not automodapi_toctreedirnm in docname: 329 return 330 processed = source[0] 331 332 # Don't show the list of inheritance info as there is no inheritance in the 333 # SBI API. This avoids all the repeated text on all doc pages that a 334 # class inherits from 'object'. 335 336 processed = processed.replace(":show-inheritance:", "") 337 # Remove the SWIG generated 'thisown' attribute. It just bloats the generated 338 # documentation and users shouldn't fiddle with the value anyway. 339 processed = re.sub(r'~SB[a-zA-Z]+\.thisown', "", processed) 340 processed = processed.replace(" .. autoattribute:: thisown", "") 341 342 # After removing 'thisown', many objects don't have any attributes left. 343 # Remove all now empty attribute summary/documentation sections with 344 # some rather ugly regex. 345 processed = empty_attr_summary.sub('.. rubric::', processed) 346 processed = empty_attr_documentation.sub('.. rubric::', processed) 347 348 # Replace the original source with the processed one (source is a single 349 # element list). 350 source[0] = processed 351 352def setup(app): 353 app.connect('source-read', cleanup_source) 354