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