]> git.proxmox.com Git - mirror_frr.git/blob - doc/developer/conf.py
Merge pull request #12384 from opensourcerouting/feature/snmp_bgp4V2PeerErrorsTable
[mirror_frr.git] / doc / developer / conf.py
1 # -*- coding: utf-8 -*-
2 #
3 # FRR documentation build configuration file, created by
4 # sphinx-quickstart on Tue Jan 31 16:00:52 2017.
5 #
6 # This file is execfile()d with the current directory set to its
7 # containing dir.
8 #
9 # Note that not all possible configuration values are present in this
10 # autogenerated file.
11 #
12 # All configuration values have a default; values that are commented out
13 # serve to show the default.
14
15 import sys
16 import os
17 import re
18 import pygments
19 from sphinx.highlighting import lexers
20 from sphinx.util import logging
21 logger = logging.getLogger(__name__)
22
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 # sys.path.insert(0, os.path.abspath('.'))
27
28 # -- General configuration ------------------------------------------------
29
30 # If your documentation needs a minimal Sphinx version, state it here.
31 needs_sphinx = "1.0"
32
33 # prolog for various variable substitutions
34 rst_prolog = ""
35
36 # Add any Sphinx extension module names here, as strings. They can be
37 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
38 # ones.
39 extensions = ["sphinx.ext.todo", "sphinx.ext.graphviz"]
40
41 # Add any paths that contain templates here, relative to this directory.
42 templates_path = ["_templates"]
43
44 # The suffix(es) of source filenames.
45 # You can specify multiple suffix as a list of string:
46 # source_suffix = ['.rst']
47 source_suffix = ".rst"
48
49 # The encoding of source files.
50 # source_encoding = 'utf-8-sig'
51
52 # The master toctree document.
53 master_doc = "index"
54
55 # General information about the project.
56 project = u"FRR"
57 copyright = u"2017, FRR"
58 author = u"FRR authors"
59
60 # The version info for the project you're documenting, acts as replacement for
61 # |version| and |release|, also used in various other places throughout the
62 # built documents.
63
64 # The short X.Y version.
65 version = u"?.?"
66 # The full version, including alpha/beta/rc tags.
67 release = u"?.?-?"
68
69
70 # -----------------------------------------------------------------------------
71 # Extract values from codebase for substitution into docs.
72 # -----------------------------------------------------------------------------
73
74 # Various installation prefixes. Values are extracted from config.status.
75 # Reasonable defaults are set in case that file does not exist.
76 replace_vars = {
77 "AUTHORS": author,
78 "COPYRIGHT_YEAR": "1999-2005",
79 "COPYRIGHT_STR": "Copyright (c) 1999-2005",
80 "PACKAGE_NAME": project.lower(),
81 "PACKAGE_TARNAME": project.lower(),
82 "PACKAGE_STRING": project.lower() + " latest",
83 "PACKAGE_URL": "https://frrouting.org/",
84 "PACKAGE_VERSION": "latest",
85 "INSTALL_PREFIX_ETC": "/etc/frr",
86 "INSTALL_PREFIX_SBIN": "/usr/lib/frr",
87 "INSTALL_PREFIX_STATE": "/var/run/frr",
88 "INSTALL_PREFIX_MODULES": "/usr/lib/frr/modules",
89 "INSTALL_USER": "frr",
90 "INSTALL_GROUP": "frr",
91 "INSTALL_VTY_GROUP": "frrvty",
92 "GROUP": "frr",
93 "USER": "frr",
94 }
95
96 # extract version information, installation location, other stuff we need to
97 # use when building final documents
98 val = re.compile('^S\["([^"]+)"\]="(.*)"$')
99 try:
100 with open("../../config.status", "r") as cfgstatus:
101 for ln in cfgstatus.readlines():
102 m = val.match(ln)
103 if not m or m.group(1) not in replace_vars.keys():
104 continue
105 replace_vars[m.group(1)] = m.group(2)
106 except IOError:
107 # if config.status doesn't exist, just ignore it
108 pass
109
110 # manually fill out some of these we can't get from config.status
111 replace_vars["COPYRIGHT_STR"] = "Copyright (c)"
112 replace_vars["COPYRIGHT_STR"] += " {0}".format(replace_vars["COPYRIGHT_YEAR"])
113 replace_vars["COPYRIGHT_STR"] += " {0}".format(replace_vars["AUTHORS"])
114 release = replace_vars["PACKAGE_VERSION"]
115 version = release.split("-")[0]
116
117 # add substitutions to prolog
118 for key, value in replace_vars.items():
119 rst_prolog += ".. |{0}| replace:: {1}\n".format(key, value)
120
121 # There are two options for replacing |today|: either, you set today to some
122 # non-false value, then it is used:
123 # today = ''
124 # Else, today_fmt is used as the format for a strftime call.
125 # today_fmt = '%B %d, %Y'
126
127 # List of patterns, relative to source directory, that match files and
128 # directories to ignore when looking for source files.
129 exclude_patterns = [
130 "_build",
131 "building-libunwind-note.rst",
132 "building-libyang.rst",
133 "topotests-snippets.rst",
134 "topotests-markers.rst",
135 "include-compile.rst",
136 ]
137
138 # The reST default role (used for this markup: `text`) to use for all
139 # documents.
140 # default_role = None
141
142 # If true, '()' will be appended to :func: etc. cross-reference text.
143 # add_function_parentheses = True
144
145 # If true, the current module name will be prepended to all description
146 # unit titles (such as .. function::).
147 # add_module_names = True
148
149 # If true, sectionauthor and moduleauthor directives will be shown in the
150 # output. They are ignored by default.
151 # show_authors = False
152
153 # The name of the Pygments (syntax highlighting) style to use.
154 pygments_style = "sphinx"
155
156 # A list of ignored prefixes for module index sorting.
157 # modindex_common_prefix = []
158
159 # If true, keep warnings as "system message" paragraphs in the built documents.
160 # keep_warnings = False
161
162 # If true, `todo` and `todoList` produce output, else they produce nothing.
163 todo_include_todos = True
164
165
166 # -- Options for HTML output ----------------------------------------------
167
168 # The theme to use for HTML and HTML Help pages. See the documentation for
169 # a list of builtin themes.
170 html_theme = "default"
171
172 try:
173 import sphinx_rtd_theme
174
175 html_theme = "sphinx_rtd_theme"
176 except ImportError:
177 pass
178
179 # Theme options are theme-specific and customize the look and feel of a theme
180 # further. For a list of options available for each theme, see the
181 # documentation.
182 # html_theme_options = {
183 # 'sidebarbgcolor': '#374249'
184 # }
185
186 # Add any paths that contain custom themes here, relative to this directory.
187 # html_theme_path = []
188
189 # The name for this set of Sphinx documents. If None, it defaults to
190 # "<project> v<release> documentation".
191 # html_title = None
192
193 # A shorter title for the navigation bar. Default is the same as html_title.
194 # html_short_title = None
195
196 # The name of an image file (relative to this directory) to place at the top
197 # of the sidebar.
198 html_logo = "../figures/frr-icon.svg"
199
200 # The name of an image file (within the static path) to use as favicon of the
201 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
202 # pixels large.
203 html_favicon = "../figures/frr-logo-icon.png"
204
205 # Add any paths that contain custom static files (such as style sheets) here,
206 # relative to this directory. They are copied after the builtin static files,
207 # so a file named "default.css" will overwrite the builtin "default.css".
208 html_static_path = ["_static"]
209
210 # Add any extra paths that contain custom files (such as robots.txt or
211 # .htaccess) here, relative to this directory. These files are copied
212 # directly to the root of the documentation.
213 # html_extra_path = []
214
215 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
216 # using the given strftime format.
217 # html_last_updated_fmt = '%b %d, %Y'
218
219 # If true, SmartyPants will be used to convert quotes and dashes to
220 # typographically correct entities.
221 # html_use_smartypants = True
222
223 # Custom sidebar templates, maps document names to template names.
224 # html_sidebars = {}
225
226 # Additional templates that should be rendered to pages, maps page names to
227 # template names.
228 # html_additional_pages = {}
229
230 # If false, no module index is generated.
231 # html_domain_indices = True
232
233 # If false, no index is generated.
234 # html_use_index = True
235
236 # If true, the index is split into individual pages for each letter.
237 # html_split_index = False
238
239 # If true, links to the reST sources are added to the pages.
240 # html_show_sourcelink = True
241
242 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
243 # html_show_sphinx = True
244
245 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
246 # html_show_copyright = True
247
248 # If true, an OpenSearch description file will be output, and all pages will
249 # contain a <link> tag referring to it. The value of this option must be the
250 # base URL from which the finished HTML is served.
251 # html_use_opensearch = ''
252
253 # This is the file name suffix for HTML files (e.g. ".xhtml").
254 # html_file_suffix = None
255
256 # Language to be used for generating the HTML full-text search index.
257 # Sphinx supports the following languages:
258 # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
259 # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
260 # html_search_language = 'en'
261
262 # A dictionary with options for the search language support, empty by default.
263 # Now only 'ja' uses this config value
264 # html_search_options = {'type': 'default'}
265
266 # The name of a javascript file (relative to the configuration directory) that
267 # implements a search results scorer. If empty, the default will be used.
268 # html_search_scorer = 'scorer.js'
269
270 # Output file base name for HTML help builder.
271 htmlhelp_basename = "FRRdoc"
272
273 # -- Options for LaTeX output ---------------------------------------------
274
275 latex_elements = {
276 # The paper size ('letterpaper' or 'a4paper').
277 #'papersize': 'letterpaper',
278 # The font size ('10pt', '11pt' or '12pt').
279 #'pointsize': '10pt',
280 # Additional stuff for the LaTeX preamble.
281 #'preamble': '',
282 # Latex figure (float) alignment
283 #'figure_align': 'htbp',
284 }
285
286 # Grouping the document tree into LaTeX files. List of tuples
287 # (source start file, target name, title,
288 # author, documentclass [howto, manual, or own class]).
289 latex_documents = [
290 (master_doc, "FRR.tex", u"FRR Developer's Manual", u"FRR", "manual"),
291 ]
292
293 # The name of an image file (relative to this directory) to place at the top of
294 # the title page.
295 latex_logo = "../figures/frr-logo-medium.png"
296
297 # For "manual" documents, if this is true, then toplevel headings are parts,
298 # not chapters.
299 # latex_use_parts = False
300
301 # If true, show page references after internal links.
302 # latex_show_pagerefs = False
303
304 # If true, show URL addresses after external links.
305 # latex_show_urls = False
306
307 # Documents to append as an appendix to all manuals.
308 # latex_appendices = []
309
310 # If false, no module index is generated.
311 # latex_domain_indices = True
312
313
314 # -- Options for manual page output ---------------------------------------
315
316 # One entry per manual page. List of tuples
317 # (source start file, name, description, authors, manual section).
318 man_pages = [(master_doc, "frr", u"FRR Developer's Manual", [author], 1)]
319
320 # If true, show URL addresses after external links.
321 # man_show_urls = False
322
323
324 # -- Options for Texinfo output -------------------------------------------
325
326 # Grouping the document tree into Texinfo files. List of tuples
327 # (source start file, target name, title, author,
328 # dir menu entry, description, category)
329 texinfo_documents = [
330 (
331 master_doc,
332 "frr",
333 u"FRR Developer's Manual",
334 author,
335 "FRR",
336 "One line description of project.",
337 "Miscellaneous",
338 ),
339 ]
340
341 # Documents to append as an appendix to all manuals.
342 # texinfo_appendices = []
343
344 # If false, no module index is generated.
345 # texinfo_domain_indices = True
346
347 # How to display URL addresses: 'footnote', 'no', or 'inline'.
348 # texinfo_show_urls = 'footnote'
349
350 # If true, do not generate a @detailmenu in the "Top" node's menu.
351 # texinfo_no_detailmenu = False
352
353 # contents of ../extra/frrlexer.py.
354 # This is read here to support VPATH build. Since this section is execfile()'d
355 # with the file location, we can safely use a relative path here to save the
356 # contents of the lexer file for later use even if our relative path changes
357 # due to VPATH.
358 with open("../extra/frrlexer.py", "rb") as lex:
359 frrlexerpy = lex.read()
360
361 frrfmt_re = re.compile(r'^\s*%(?P<spec>[^\s]+)\s+\((?P<types>.*)\)\s*$')
362
363 def parse_frrfmt(env, text, node):
364 from sphinx import addnodes
365
366 m = frrfmt_re.match(text)
367 if not m:
368 logger.warning('could not parse frrfmt:: %r' % (text), location=node)
369 node += addnodes.desc_name(text, text)
370 return text
371
372 spec, types = m.group('spec'), m.group('types')
373
374 node += addnodes.desc_sig_operator('%', '%')
375 node += addnodes.desc_name(spec + ' ', spec + ' ')
376 plist = addnodes.desc_parameterlist()
377 for typ in types.split(','):
378 typ = typ.strip()
379 plist += addnodes.desc_parameter(typ, typ)
380 node += plist
381 return '%' + spec
382
383 # custom extensions here
384 def setup(app):
385 # object type for FRR CLI commands, can be extended to document parent CLI
386 # node later on
387 app.add_object_type("clicmd", "clicmd")
388
389 # printfrr extensions
390 app.add_object_type("frrfmt", "frrfmt", parse_node=parse_frrfmt)
391
392 if "add_css_file" in dir(app):
393 app.add_css_file("overrides.css")
394 else:
395 app.add_stylesheet("overrides.css")
396
397 # load Pygments lexer for FRR config syntax
398 #
399 # NB: in Pygments 2.2+ this can be done with `load_lexer_from_file`, but we
400 # do it manually since not all of our supported build platforms have 2.2
401 # yet.
402 #
403 # frrlexer = pygments.lexers.load_lexer_from_file('../extra/frrlexer.py', lexername="FRRLexer")
404 custom_namespace = {}
405 exec(frrlexerpy, custom_namespace)
406 lexers["frr"] = custom_namespace["FRRLexer"]()