conf.py 18 KB

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