Merge tag 'u-boot-stm32-20200528' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm
[oweals/u-boot.git] / doc / conf.py
1 # -*- coding: utf-8 -*-
2 #
3 # The U-Boot documentation build configuration file, created by
4 # sphinx-quickstart on Fri Feb 12 13:51:46 2016.
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 sphinx
18
19 # Get Sphinx version
20 major, minor, patch = sphinx.version_info[:3]
21
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('sphinx'))
27 from load_config import loadConfig
28
29 # -- General configuration ------------------------------------------------
30
31 # If your documentation needs a minimal Sphinx version, state it here.
32 needs_sphinx = '1.3'
33
34 latex_engine = 'xelatex'
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 = ['kerneldoc', 'rstFlatTable', 'kernel_include', 'cdomain', 'kfigure']
40
41 # The name of the math extension changed on Sphinx 1.4
42 if (major == 1 and minor > 3) or (major > 1):
43     extensions.append("sphinx.ext.imgmath")
44 else:
45     extensions.append("sphinx.ext.pngmath")
46
47 # Add any paths that contain templates here, relative to this directory.
48 templates_path = ['_templates']
49
50 # The suffix(es) of source filenames.
51 # You can specify multiple suffix as a list of string:
52 # source_suffix = ['.rst', '.md']
53 source_suffix = '.rst'
54
55 # The encoding of source files.
56 #source_encoding = 'utf-8-sig'
57
58 # The master toctree document.
59 master_doc = 'index'
60
61 # General information about the project.
62 project = 'Das U-Boot'
63 copyright = 'The U-Boot development community'
64 author = 'The U-Boot development community'
65
66 # The version info for the project you're documenting, acts as replacement for
67 # |version| and |release|, also used in various other places throughout the
68 # built documents.
69 #
70 # In a normal build, version and release are are set to KERNELVERSION and
71 # KERNELRELEASE, respectively, from the Makefile via Sphinx command line
72 # arguments.
73 #
74 # The following code tries to extract the information by reading the Makefile,
75 # when Sphinx is run directly (e.g. by Read the Docs).
76 try:
77     makefile_version = None
78     makefile_patchlevel = None
79     for line in open('../Makefile'):
80         key, val = [x.strip() for x in line.split('=', 2)]
81         if key == 'VERSION':
82             makefile_version = val
83         elif key == 'PATCHLEVEL':
84             makefile_patchlevel = val
85         if makefile_version and makefile_patchlevel:
86             break
87 except:
88     pass
89 finally:
90     if makefile_version and makefile_patchlevel:
91         version = release = makefile_version + '.' + makefile_patchlevel
92     else:
93         version = release = "unknown version"
94
95 # The language for content autogenerated by Sphinx. Refer to documentation
96 # for a list of supported languages.
97 #
98 # This is also used if you do content translation via gettext catalogs.
99 # Usually you set "language" from the command line for these cases.
100 language = None
101
102 # There are two options for replacing |today|: either, you set today to some
103 # non-false value, then it is used:
104 #today = ''
105 # Else, today_fmt is used as the format for a strftime call.
106 #today_fmt = '%B %d, %Y'
107
108 # List of patterns, relative to source directory, that match files and
109 # directories to ignore when looking for source files.
110 exclude_patterns = ['output']
111
112 # The reST default role (used for this markup: `text`) to use for all
113 # documents.
114 #default_role = None
115
116 # If true, '()' will be appended to :func: etc. cross-reference text.
117 #add_function_parentheses = True
118
119 # If true, the current module name will be prepended to all description
120 # unit titles (such as .. function::).
121 #add_module_names = True
122
123 # If true, sectionauthor and moduleauthor directives will be shown in the
124 # output. They are ignored by default.
125 #show_authors = False
126
127 # The name of the Pygments (syntax highlighting) style to use.
128 pygments_style = 'sphinx'
129
130 # A list of ignored prefixes for module index sorting.
131 #modindex_common_prefix = []
132
133 # If true, keep warnings as "system message" paragraphs in the built documents.
134 #keep_warnings = False
135
136 # If true, `todo` and `todoList` produce output, else they produce nothing.
137 todo_include_todos = False
138
139 primary_domain = 'c'
140 highlight_language = 'none'
141
142 # -- Options for HTML output ----------------------------------------------
143
144 # The theme to use for HTML and HTML Help pages.  See the documentation for
145 # a list of builtin themes.
146
147 # The Read the Docs theme is available from
148 # - https://github.com/snide/sphinx_rtd_theme
149 # - https://pypi.python.org/pypi/sphinx_rtd_theme
150 # - python-sphinx-rtd-theme package (on Debian)
151 try:
152     import sphinx_rtd_theme
153     html_theme = 'sphinx_rtd_theme'
154     html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
155 except ImportError:
156     sys.stderr.write('Warning: The Sphinx \'sphinx_rtd_theme\' HTML theme was not found. Make sure you have the theme installed to produce pretty HTML output. Falling back to the default theme.\n')
157
158 # Theme options are theme-specific and customize the look and feel of a theme
159 # further.  For a list of options available for each theme, see the
160 # documentation.
161 #html_theme_options = {}
162
163 # Add any paths that contain custom themes here, relative to this directory.
164 #html_theme_path = []
165
166 # The name for this set of Sphinx documents.  If None, it defaults to
167 # "<project> v<release> documentation".
168 #html_title = None
169
170 # A shorter title for the navigation bar.  Default is the same as html_title.
171 #html_short_title = None
172
173 # The name of an image file (relative to this directory) to place at the top
174 # of the sidebar.
175 html_logo = '../tools/logos/u-boot_logo.svg'
176
177 # The name of an image file (within the static path) to use as favicon of the
178 # docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
179 # pixels large.
180 #html_favicon = None
181
182 # Add any paths that contain custom static files (such as style sheets) here,
183 # relative to this directory. They are copied after the builtin static files,
184 # so a file named "default.css" will overwrite the builtin "default.css".
185
186 html_static_path = ['sphinx-static']
187
188 html_context = {
189     'css_files': [
190         '_static/theme_overrides.css',
191     ],
192 }
193
194 # Add any extra paths that contain custom files (such as robots.txt or
195 # .htaccess) here, relative to this directory. These files are copied
196 # directly to the root of the documentation.
197 #html_extra_path = []
198
199 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
200 # using the given strftime format.
201 #html_last_updated_fmt = '%b %d, %Y'
202
203 # If true, SmartyPants will be used to convert quotes and dashes to
204 # typographically correct entities.
205 #html_use_smartypants = True
206
207 # Custom sidebar templates, maps document names to template names.
208 #html_sidebars = {}
209
210 # Additional templates that should be rendered to pages, maps page names to
211 # template names.
212 #html_additional_pages = {}
213
214 # If false, no module index is generated.
215 #html_domain_indices = True
216
217 # If false, no index is generated.
218 #html_use_index = True
219
220 # If true, the index is split into individual pages for each letter.
221 #html_split_index = False
222
223 # If true, links to the reST sources are added to the pages.
224 #html_show_sourcelink = True
225
226 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
227 #html_show_sphinx = True
228
229 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
230 #html_show_copyright = True
231
232 # If true, an OpenSearch description file will be output, and all pages will
233 # contain a <link> tag referring to it.  The value of this option must be the
234 # base URL from which the finished HTML is served.
235 #html_use_opensearch = ''
236
237 # This is the file name suffix for HTML files (e.g. ".xhtml").
238 #html_file_suffix = None
239
240 # Language to be used for generating the HTML full-text search index.
241 # Sphinx supports the following languages:
242 #   'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
243 #   'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
244 #html_search_language = 'en'
245
246 # A dictionary with options for the search language support, empty by default.
247 # Now only 'ja' uses this config value
248 #html_search_options = {'type': 'default'}
249
250 # The name of a javascript file (relative to the configuration directory) that
251 # implements a search results scorer. If empty, the default will be used.
252 #html_search_scorer = 'scorer.js'
253
254 # Output file base name for HTML help builder.
255 htmlhelp_basename = 'TheUBootdoc'
256
257 # -- Options for LaTeX output ---------------------------------------------
258
259 latex_elements = {
260 # The paper size ('letterpaper' or 'a4paper').
261 'papersize': 'a4paper',
262
263 # The font size ('10pt', '11pt' or '12pt').
264 'pointsize': '8pt',
265
266 # Latex figure (float) alignment
267 #'figure_align': 'htbp',
268
269 # Don't mangle with UTF-8 chars
270 'inputenc': '',
271 'utf8extra': '',
272
273 # Additional stuff for the LaTeX preamble.
274     'preamble': '''
275         % Use some font with UTF-8 support with XeLaTeX
276         \\usepackage{fontspec}
277         \\setsansfont{DejaVu Serif}
278         \\setromanfont{DejaVu Sans}
279         \\setmonofont{DejaVu Sans Mono}
280
281      '''
282 }
283
284 # Fix reference escape troubles with Sphinx 1.4.x
285 if major == 1 and minor > 3:
286     latex_elements['preamble']  += '\\renewcommand*{\\DUrole}[2]{ #2 }\n'
287
288 if major == 1 and minor <= 4:
289     latex_elements['preamble']  += '\\usepackage[margin=0.5in, top=1in, bottom=1in]{geometry}'
290 elif major == 1 and (minor > 5 or (minor == 5 and patch >= 3)):
291     latex_elements['sphinxsetup'] = 'hmargin=0.5in, vmargin=1in'
292     latex_elements['preamble']  += '\\fvset{fontsize=auto}\n'
293
294 # Customize notice background colors on Sphinx < 1.6:
295 if major == 1 and minor < 6:
296    latex_elements['preamble']  += '''
297         \\usepackage{ifthen}
298
299         % Put notes in color and let them be inside a table
300         \\definecolor{NoteColor}{RGB}{204,255,255}
301         \\definecolor{WarningColor}{RGB}{255,204,204}
302         \\definecolor{AttentionColor}{RGB}{255,255,204}
303         \\definecolor{ImportantColor}{RGB}{192,255,204}
304         \\definecolor{OtherColor}{RGB}{204,204,204}
305         \\newlength{\\mynoticelength}
306         \\makeatletter\\newenvironment{coloredbox}[1]{%
307            \\setlength{\\fboxrule}{1pt}
308            \\setlength{\\fboxsep}{7pt}
309            \\setlength{\\mynoticelength}{\\linewidth}
310            \\addtolength{\\mynoticelength}{-2\\fboxsep}
311            \\addtolength{\\mynoticelength}{-2\\fboxrule}
312            \\begin{lrbox}{\\@tempboxa}\\begin{minipage}{\\mynoticelength}}{\\end{minipage}\\end{lrbox}%
313            \\ifthenelse%
314               {\\equal{\\py@noticetype}{note}}%
315               {\\colorbox{NoteColor}{\\usebox{\\@tempboxa}}}%
316               {%
317                  \\ifthenelse%
318                  {\\equal{\\py@noticetype}{warning}}%
319                  {\\colorbox{WarningColor}{\\usebox{\\@tempboxa}}}%
320                  {%
321                     \\ifthenelse%
322                     {\\equal{\\py@noticetype}{attention}}%
323                     {\\colorbox{AttentionColor}{\\usebox{\\@tempboxa}}}%
324                     {%
325                        \\ifthenelse%
326                        {\\equal{\\py@noticetype}{important}}%
327                        {\\colorbox{ImportantColor}{\\usebox{\\@tempboxa}}}%
328                        {\\colorbox{OtherColor}{\\usebox{\\@tempboxa}}}%
329                     }%
330                  }%
331               }%
332         }\\makeatother
333
334         \\makeatletter
335         \\renewenvironment{notice}[2]{%
336           \\def\\py@noticetype{#1}
337           \\begin{coloredbox}{#1}
338           \\bf\\it
339           \\par\\strong{#2}
340           \\csname py@noticestart@#1\\endcsname
341         }
342         {
343           \\csname py@noticeend@\\py@noticetype\\endcsname
344           \\end{coloredbox}
345         }
346         \\makeatother
347
348      '''
349
350 # With Sphinx 1.6, it is possible to change the Bg color directly
351 # by using:
352 #       \definecolor{sphinxnoteBgColor}{RGB}{204,255,255}
353 #       \definecolor{sphinxwarningBgColor}{RGB}{255,204,204}
354 #       \definecolor{sphinxattentionBgColor}{RGB}{255,255,204}
355 #       \definecolor{sphinximportantBgColor}{RGB}{192,255,204}
356 #
357 # However, it require to use sphinx heavy box with:
358 #
359 #       \renewenvironment{sphinxlightbox} {%
360 #               \\begin{sphinxheavybox}
361 #       }
362 #               \\end{sphinxheavybox}
363 #       }
364 #
365 # Unfortunately, the implementation is buggy: if a note is inside a
366 # table, it isn't displayed well. So, for now, let's use boring
367 # black and white notes.
368
369 # Grouping the document tree into LaTeX files. List of tuples
370 # (source start file, target name, title,
371 #  author, documentclass [howto, manual, or own class]).
372 # Sorted in alphabetical order
373 latex_documents = [
374     ('index', 'u-boot-hacker-manual.tex', 'U-Boot Hacker Manual',
375      'The U-Boot development community', 'manual'),
376 ]
377
378 # The name of an image file (relative to this directory) to place at the top of
379 # the title page.
380 #latex_logo = None
381
382 # For "manual" documents, if this is true, then toplevel headings are parts,
383 # not chapters.
384 #latex_use_parts = False
385
386 # If true, show page references after internal links.
387 #latex_show_pagerefs = False
388
389 # If true, show URL addresses after external links.
390 #latex_show_urls = False
391
392 # Documents to append as an appendix to all manuals.
393 #latex_appendices = []
394
395 # If false, no module index is generated.
396 #latex_domain_indices = True
397
398
399 # -- Options for manual page output ---------------------------------------
400
401 # One entry per manual page. List of tuples
402 # (source start file, name, description, authors, manual section).
403 man_pages = [
404     (master_doc, 'dasuboot', 'The U-Boot Documentation',
405      [author], 1)
406 ]
407
408 # If true, show URL addresses after external links.
409 #man_show_urls = False
410
411
412 # -- Options for Texinfo output -------------------------------------------
413
414 # Grouping the document tree into Texinfo files. List of tuples
415 # (source start file, target name, title, author,
416 #  dir menu entry, description, category)
417 texinfo_documents = [
418     (master_doc, 'DasUBoot', 'The U-Boot Documentation',
419      author, 'DasUBoot', 'One line description of project.',
420      'Miscellaneous'),
421 ]
422
423 # Documents to append as an appendix to all manuals.
424 #texinfo_appendices = []
425
426 # If false, no module index is generated.
427 #texinfo_domain_indices = True
428
429 # How to display URL addresses: 'footnote', 'no', or 'inline'.
430 #texinfo_show_urls = 'footnote'
431
432 # If true, do not generate a @detailmenu in the "Top" node's menu.
433 #texinfo_no_detailmenu = False
434
435
436 # -- Options for Epub output ----------------------------------------------
437
438 # Bibliographic Dublin Core info.
439 epub_title = project
440 epub_author = author
441 epub_publisher = author
442 epub_copyright = copyright
443
444 # The basename for the epub file. It defaults to the project name.
445 #epub_basename = project
446
447 # The HTML theme for the epub output. Since the default themes are not
448 # optimized for small screen space, using the same theme for HTML and epub
449 # output is usually not wise. This defaults to 'epub', a theme designed to save
450 # visual space.
451 #epub_theme = 'epub'
452
453 # The language of the text. It defaults to the language option
454 # or 'en' if the language is not set.
455 #epub_language = ''
456
457 # The scheme of the identifier. Typical schemes are ISBN or URL.
458 #epub_scheme = ''
459
460 # The unique identifier of the text. This can be a ISBN number
461 # or the project homepage.
462 #epub_identifier = ''
463
464 # A unique identification for the text.
465 #epub_uid = ''
466
467 # A tuple containing the cover image and cover page html template filenames.
468 #epub_cover = ()
469
470 # A sequence of (type, uri, title) tuples for the guide element of content.opf.
471 #epub_guide = ()
472
473 # HTML files that should be inserted before the pages created by sphinx.
474 # The format is a list of tuples containing the path and title.
475 #epub_pre_files = []
476
477 # HTML files that should be inserted after the pages created by sphinx.
478 # The format is a list of tuples containing the path and title.
479 #epub_post_files = []
480
481 # A list of files that should not be packed into the epub file.
482 epub_exclude_files = ['search.html']
483
484 # The depth of the table of contents in toc.ncx.
485 #epub_tocdepth = 3
486
487 # Allow duplicate toc entries.
488 #epub_tocdup = True
489
490 # Choose between 'default' and 'includehidden'.
491 #epub_tocscope = 'default'
492
493 # Fix unsupported image types using the Pillow.
494 #epub_fix_images = False
495
496 # Scale large images.
497 #epub_max_image_width = 0
498
499 # How to display URL addresses: 'footnote', 'no', or 'inline'.
500 #epub_show_urls = 'inline'
501
502 # If false, no index is generated.
503 #epub_use_index = True
504
505 #=======
506 # rst2pdf
507 #
508 # Grouping the document tree into PDF files. List of tuples
509 # (source start file, target name, title, author, options).
510 #
511 # See the Sphinx chapter of http://ralsina.me/static/manual.pdf
512 #
513 # FIXME: Do not add the index file here; the result will be too big. Adding
514 # multiple PDF files here actually tries to get the cross-referencing right
515 # *between* PDF files.
516 pdf_documents = [
517     ('uboot-documentation', u'U-Boot', u'U-Boot', u'J. Random Bozo'),
518 ]
519
520 # kernel-doc extension configuration for running Sphinx directly (e.g. by Read
521 # the Docs). In a normal build, these are supplied from the Makefile via command
522 # line arguments.
523 kerneldoc_bin = '../scripts/kernel-doc'
524 kerneldoc_srctree = '..'
525
526 # ------------------------------------------------------------------------------
527 # Since loadConfig overwrites settings from the global namespace, it has to be
528 # the last statement in the conf.py file
529 # ------------------------------------------------------------------------------
530 loadConfig(globals())