]>
git.proxmox.com Git - mirror_frr.git/blob - doc/developer/conf.py
1 # -*- coding: utf-8 -*-
3 # FRR documentation build configuration file, created by
4 # sphinx-quickstart on Tue Jan 31 16:00:52 2017.
6 # This file is execfile()d with the current directory set to its
9 # Note that not all possible configuration values are present in this
12 # All configuration values have a default; values that are commented out
13 # serve to show the default.
19 from sphinx
.highlighting
import lexers
20 from sphinx
.util
import logging
21 logger
= logging
.getLogger(__name__
)
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('.'))
28 # -- General configuration ------------------------------------------------
30 # If your documentation needs a minimal Sphinx version, state it here.
33 # prolog for various variable substitutions
36 # Add any Sphinx extension module names here, as strings. They can be
37 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
39 extensions
= ["sphinx.ext.todo", "sphinx.ext.graphviz"]
41 # Add any paths that contain templates here, relative to this directory.
42 templates_path
= ["_templates"]
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"
49 # The encoding of source files.
50 # source_encoding = 'utf-8-sig'
52 # The master toctree document.
55 # General information about the project.
57 copyright
= u
"2017, FRR"
58 author
= u
"FRR authors"
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
64 # The short X.Y version.
66 # The full version, including alpha/beta/rc tags.
70 # -----------------------------------------------------------------------------
71 # Extract values from codebase for substitution into docs.
72 # -----------------------------------------------------------------------------
74 # Various installation prefixes. Values are extracted from config.status.
75 # Reasonable defaults are set in case that file does not exist.
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",
96 # extract version information, installation location, other stuff we need to
97 # use when building final documents
98 val
= re
.compile('^S\["([^"]+)"\]="(.*)"$')
100 with
open("../../config.status", "r") as cfgstatus
:
101 for ln
in cfgstatus
.readlines():
103 if not m
or m
.group(1) not in replace_vars
.keys():
105 replace_vars
[m
.group(1)] = m
.group(2)
107 # if config.status doesn't exist, just ignore it
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]
117 # add substitutions to prolog
118 for key
, value
in replace_vars
.items():
119 rst_prolog
+= ".. |{0}| replace:: {1}\n".format(key
, value
)
121 # There are two options for replacing |today|: either, you set today to some
122 # non-false value, then it is used:
124 # Else, today_fmt is used as the format for a strftime call.
125 # today_fmt = '%B %d, %Y'
127 # List of patterns, relative to source directory, that match files and
128 # directories to ignore when looking for source files.
131 "building-libunwind-note.rst",
132 "building-libyang.rst",
133 "topotests-snippets.rst",
134 "topotests-markers.rst",
135 "include-compile.rst",
138 # The reST default role (used for this markup: `text`) to use for all
140 # default_role = None
142 # If true, '()' will be appended to :func: etc. cross-reference text.
143 # add_function_parentheses = True
145 # If true, the current module name will be prepended to all description
146 # unit titles (such as .. function::).
147 # add_module_names = True
149 # If true, sectionauthor and moduleauthor directives will be shown in the
150 # output. They are ignored by default.
151 # show_authors = False
153 # The name of the Pygments (syntax highlighting) style to use.
154 pygments_style
= "sphinx"
156 # A list of ignored prefixes for module index sorting.
157 # modindex_common_prefix = []
159 # If true, keep warnings as "system message" paragraphs in the built documents.
160 # keep_warnings = False
162 # If true, `todo` and `todoList` produce output, else they produce nothing.
163 todo_include_todos
= True
166 # -- Options for HTML output ----------------------------------------------
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"
173 import sphinx_rtd_theme
175 html_theme
= "sphinx_rtd_theme"
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
182 # html_theme_options = {
183 # 'sidebarbgcolor': '#374249'
186 # Add any paths that contain custom themes here, relative to this directory.
187 # html_theme_path = []
189 # The name for this set of Sphinx documents. If None, it defaults to
190 # "<project> v<release> documentation".
193 # A shorter title for the navigation bar. Default is the same as html_title.
194 # html_short_title = None
196 # The name of an image file (relative to this directory) to place at the top
198 html_logo
= "../figures/frr-icon.svg"
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
203 html_favicon
= "../figures/frr-logo-icon.png"
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"]
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 = []
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'
219 # If true, SmartyPants will be used to convert quotes and dashes to
220 # typographically correct entities.
221 # html_use_smartypants = True
223 # Custom sidebar templates, maps document names to template names.
226 # Additional templates that should be rendered to pages, maps page names to
228 # html_additional_pages = {}
230 # If false, no module index is generated.
231 # html_domain_indices = True
233 # If false, no index is generated.
234 # html_use_index = True
236 # If true, the index is split into individual pages for each letter.
237 # html_split_index = False
239 # If true, links to the reST sources are added to the pages.
240 # html_show_sourcelink = True
242 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
243 # html_show_sphinx = True
245 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
246 # html_show_copyright = True
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 = ''
253 # This is the file name suffix for HTML files (e.g. ".xhtml").
254 # html_file_suffix = None
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'
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'}
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'
270 # Output file base name for HTML help builder.
271 htmlhelp_basename
= "FRRdoc"
273 # -- Options for LaTeX output ---------------------------------------------
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.
282 # Latex figure (float) alignment
283 #'figure_align': 'htbp',
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]).
290 (master_doc
, "FRR.tex", u
"FRR Developer's Manual", u
"FRR", "manual"),
293 # The name of an image file (relative to this directory) to place at the top of
295 latex_logo
= "../figures/frr-logo-medium.png"
297 # For "manual" documents, if this is true, then toplevel headings are parts,
299 # latex_use_parts = False
301 # If true, show page references after internal links.
302 # latex_show_pagerefs = False
304 # If true, show URL addresses after external links.
305 # latex_show_urls = False
307 # Documents to append as an appendix to all manuals.
308 # latex_appendices = []
310 # If false, no module index is generated.
311 # latex_domain_indices = True
314 # -- Options for manual page output ---------------------------------------
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)]
320 # If true, show URL addresses after external links.
321 # man_show_urls = False
324 # -- Options for Texinfo output -------------------------------------------
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
= [
333 u
"FRR Developer's Manual",
336 "One line description of project.",
341 # Documents to append as an appendix to all manuals.
342 # texinfo_appendices = []
344 # If false, no module index is generated.
345 # texinfo_domain_indices = True
347 # How to display URL addresses: 'footnote', 'no', or 'inline'.
348 # texinfo_show_urls = 'footnote'
350 # If true, do not generate a @detailmenu in the "Top" node's menu.
351 # texinfo_no_detailmenu = False
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
358 with
open("../extra/frrlexer.py", "rb") as lex
:
359 frrlexerpy
= lex
.read()
361 frrfmt_re
= re
.compile(r
'^\s*%(?P<spec>[^\s]+)\s+\((?P<types>.*)\)\s*$')
363 def parse_frrfmt(env
, text
, node
):
364 from sphinx
import addnodes
366 m
= frrfmt_re
.match(text
)
368 logger
.warning('could not parse frrfmt:: %r' % (text
), location
=node
)
369 node
+= addnodes
.desc_name(text
, text
)
372 spec
, types
= m
.group('spec'), m
.group('types')
374 node
+= addnodes
.desc_sig_operator('%', '%')
375 node
+= addnodes
.desc_name(spec
+ ' ', spec
+ ' ')
376 plist
= addnodes
.desc_parameterlist()
377 for typ
in types
.split(','):
379 plist
+= addnodes
.desc_parameter(typ
, typ
)
383 # custom extensions here
385 # object type for FRR CLI commands, can be extended to document parent CLI
387 app
.add_object_type("clicmd", "clicmd")
389 # printfrr extensions
390 app
.add_object_type("frrfmt", "frrfmt", parse_node
=parse_frrfmt
)
392 if "add_css_file" in dir(app
):
393 app
.add_css_file("overrides.css")
395 app
.add_stylesheet("overrides.css")
397 # load Pygments lexer for FRR config syntax
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
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"]()