conf.py 18 KB

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