conf.py 18 KB

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