conf.py 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  1. # -*- coding: utf-8 -*-
  2. #
  3. # The Linux Kernel 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. import shutil
  18. # helper
  19. # ------
  20. def have_command(cmd):
  21. """Search ``cmd`` in the ``PATH`` environment.
  22. If found, return True.
  23. If not found, return False.
  24. """
  25. return shutil.which(cmd) is not None
  26. # Get Sphinx version
  27. major, minor, patch = sphinx.version_info[:3]
  28. # If extensions (or modules to document with autodoc) are in another directory,
  29. # add these directories to sys.path here. If the directory is relative to the
  30. # documentation root, use os.path.abspath to make it absolute, like shown here.
  31. sys.path.insert(0, os.path.abspath('sphinx'))
  32. from load_config import loadConfig
  33. # -- General configuration ------------------------------------------------
  34. # If your documentation needs a minimal Sphinx version, state it here.
  35. needs_sphinx = '1.7'
  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',
  40. 'kfigure', 'sphinx.ext.ifconfig', 'automarkup',
  41. 'maintainers_include', 'sphinx.ext.autosectionlabel',
  42. 'kernel_abi', 'kernel_feat']
  43. if major >= 3:
  44. if (major > 3) or (minor > 0 or patch >= 2):
  45. # Sphinx c function parser is more pedantic with regards to type
  46. # checking. Due to that, having macros at c:function cause problems.
  47. # Those needed to be scaped by using c_id_attributes[] array
  48. c_id_attributes = [
  49. # GCC Compiler types not parsed by Sphinx:
  50. "__restrict__",
  51. # include/linux/compiler_types.h:
  52. "__iomem",
  53. "__kernel",
  54. "noinstr",
  55. "notrace",
  56. "__percpu",
  57. "__rcu",
  58. "__user",
  59. # include/linux/compiler_attributes.h:
  60. "__alias",
  61. "__aligned",
  62. "__aligned_largest",
  63. "__always_inline",
  64. "__assume_aligned",
  65. "__cold",
  66. "__attribute_const__",
  67. "__copy",
  68. "__pure",
  69. "__designated_init",
  70. "__visible",
  71. "__printf",
  72. "__scanf",
  73. "__gnu_inline",
  74. "__malloc",
  75. "__mode",
  76. "__no_caller_saved_registers",
  77. "__noclone",
  78. "__nonstring",
  79. "__noreturn",
  80. "__packed",
  81. "__pure",
  82. "__section",
  83. "__always_unused",
  84. "__maybe_unused",
  85. "__used",
  86. "__weak",
  87. "noinline",
  88. "__fix_address",
  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. # Load math renderer:
  104. # For html builder, load imgmath only when its dependencies are met.
  105. # mathjax is the default math renderer since Sphinx 1.8.
  106. have_latex = have_command('latex')
  107. have_dvipng = have_command('dvipng')
  108. load_imgmath = have_latex and have_dvipng
  109. # Respect SPHINX_IMGMATH (for html docs only)
  110. if 'SPHINX_IMGMATH' in os.environ:
  111. env_sphinx_imgmath = os.environ['SPHINX_IMGMATH']
  112. if 'yes' in env_sphinx_imgmath:
  113. load_imgmath = True
  114. elif 'no' in env_sphinx_imgmath:
  115. load_imgmath = False
  116. else:
  117. sys.stderr.write("Unknown env SPHINX_IMGMATH=%s ignored.\n" % env_sphinx_imgmath)
  118. # Always load imgmath for Sphinx <1.8 or for epub docs
  119. load_imgmath = (load_imgmath or (major == 1 and minor < 8)
  120. or 'epub' in sys.argv)
  121. if load_imgmath:
  122. extensions.append("sphinx.ext.imgmath")
  123. math_renderer = 'imgmath'
  124. else:
  125. math_renderer = 'mathjax'
  126. # Add any paths that contain templates here, relative to this directory.
  127. templates_path = ['_templates']
  128. # The suffix(es) of source filenames.
  129. # You can specify multiple suffix as a list of string:
  130. # source_suffix = ['.rst', '.md']
  131. source_suffix = '.rst'
  132. # The encoding of source files.
  133. #source_encoding = 'utf-8-sig'
  134. # The master toctree document.
  135. master_doc = 'index'
  136. # General information about the project.
  137. project = 'The Linux Kernel'
  138. copyright = 'The kernel development community'
  139. author = 'The kernel development community'
  140. # The version info for the project you're documenting, acts as replacement for
  141. # |version| and |release|, also used in various other places throughout the
  142. # built documents.
  143. #
  144. # In a normal build, version and release are are set to KERNELVERSION and
  145. # KERNELRELEASE, respectively, from the Makefile via Sphinx command line
  146. # arguments.
  147. #
  148. # The following code tries to extract the information by reading the Makefile,
  149. # when Sphinx is run directly (e.g. by Read the Docs).
  150. try:
  151. makefile_version = None
  152. makefile_patchlevel = None
  153. for line in open('../Makefile'):
  154. key, val = [x.strip() for x in line.split('=', 2)]
  155. if key == 'VERSION':
  156. makefile_version = val
  157. elif key == 'PATCHLEVEL':
  158. makefile_patchlevel = val
  159. if makefile_version and makefile_patchlevel:
  160. break
  161. except:
  162. pass
  163. finally:
  164. if makefile_version and makefile_patchlevel:
  165. version = release = makefile_version + '.' + makefile_patchlevel
  166. else:
  167. version = release = "unknown version"
  168. # The language for content autogenerated by Sphinx. Refer to documentation
  169. # for a list of supported languages.
  170. #
  171. # This is also used if you do content translation via gettext catalogs.
  172. # Usually you set "language" from the command line for these cases.
  173. language = 'en'
  174. # There are two options for replacing |today|: either, you set today to some
  175. # non-false value, then it is used:
  176. #today = ''
  177. # Else, today_fmt is used as the format for a strftime call.
  178. #today_fmt = '%B %d, %Y'
  179. # List of patterns, relative to source directory, that match files and
  180. # directories to ignore when looking for source files.
  181. exclude_patterns = ['output']
  182. # The reST default role (used for this markup: `text`) to use for all
  183. # documents.
  184. #default_role = None
  185. # If true, '()' will be appended to :func: etc. cross-reference text.
  186. #add_function_parentheses = True
  187. # If true, the current module name will be prepended to all description
  188. # unit titles (such as .. function::).
  189. #add_module_names = True
  190. # If true, sectionauthor and moduleauthor directives will be shown in the
  191. # output. They are ignored by default.
  192. #show_authors = False
  193. # The name of the Pygments (syntax highlighting) style to use.
  194. pygments_style = 'sphinx'
  195. # A list of ignored prefixes for module index sorting.
  196. #modindex_common_prefix = []
  197. # If true, keep warnings as "system message" paragraphs in the built documents.
  198. #keep_warnings = False
  199. # If true, `todo` and `todoList` produce output, else they produce nothing.
  200. todo_include_todos = False
  201. primary_domain = 'c'
  202. highlight_language = 'none'
  203. # -- Options for HTML output ----------------------------------------------
  204. # The theme to use for HTML and HTML Help pages. See the documentation for
  205. # a list of builtin themes.
  206. # Default theme
  207. html_theme = 'sphinx_rtd_theme'
  208. html_css_files = []
  209. if "DOCS_THEME" in os.environ:
  210. html_theme = os.environ["DOCS_THEME"]
  211. if html_theme == 'sphinx_rtd_theme' or html_theme == 'sphinx_rtd_dark_mode':
  212. # Read the Docs theme
  213. try:
  214. import sphinx_rtd_theme
  215. html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
  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_css_files = [
  220. 'theme_overrides.css',
  221. ]
  222. # Read the Docs dark mode override theme
  223. if html_theme == 'sphinx_rtd_dark_mode':
  224. try:
  225. import sphinx_rtd_dark_mode
  226. extensions.append('sphinx_rtd_dark_mode')
  227. except ImportError:
  228. html_theme == 'sphinx_rtd_theme'
  229. if html_theme == 'sphinx_rtd_theme':
  230. # Add color-specific RTD normal mode
  231. html_css_files.append('theme_rtd_colors.css')
  232. except ImportError:
  233. html_theme = 'classic'
  234. if "DOCS_CSS" in os.environ:
  235. css = os.environ["DOCS_CSS"].split(" ")
  236. for l in css:
  237. html_css_files.append(l)
  238. if major <= 1 and minor < 8:
  239. html_context = {
  240. 'css_files': [],
  241. }
  242. for l in html_css_files:
  243. html_context['css_files'].append('_static/' + l)
  244. if html_theme == 'classic':
  245. html_theme_options = {
  246. 'rightsidebar': False,
  247. 'stickysidebar': True,
  248. 'collapsiblesidebar': True,
  249. 'externalrefs': False,
  250. 'footerbgcolor': "white",
  251. 'footertextcolor': "white",
  252. 'sidebarbgcolor': "white",
  253. 'sidebarbtncolor': "black",
  254. 'sidebartextcolor': "black",
  255. 'sidebarlinkcolor': "#686bff",
  256. 'relbarbgcolor': "#133f52",
  257. 'relbartextcolor': "white",
  258. 'relbarlinkcolor': "white",
  259. 'bgcolor': "white",
  260. 'textcolor': "black",
  261. 'headbgcolor': "#f2f2f2",
  262. 'headtextcolor': "#20435c",
  263. 'headlinkcolor': "#c60f0f",
  264. 'linkcolor': "#355f7c",
  265. 'visitedlinkcolor': "#355f7c",
  266. 'codebgcolor': "#3f3f3f",
  267. 'codetextcolor': "white",
  268. 'bodyfont': "serif",
  269. 'headfont': "sans-serif",
  270. }
  271. sys.stderr.write("Using %s theme\n" % html_theme)
  272. # Theme options are theme-specific and customize the look and feel of a theme
  273. # further. For a list of options available for each theme, see the
  274. # documentation.
  275. #html_theme_options = {}
  276. # Add any paths that contain custom themes here, relative to this directory.
  277. #html_theme_path = []
  278. # The name for this set of Sphinx documents. If None, it defaults to
  279. # "<project> v<release> documentation".
  280. #html_title = None
  281. # A shorter title for the navigation bar. Default is the same as html_title.
  282. #html_short_title = None
  283. # The name of an image file (relative to this directory) to place at the top
  284. # of the sidebar.
  285. #html_logo = None
  286. # The name of an image file (within the static path) to use as favicon of the
  287. # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
  288. # pixels large.
  289. #html_favicon = None
  290. # Add any paths that contain custom static files (such as style sheets) here,
  291. # relative to this directory. They are copied after the builtin static files,
  292. # so a file named "default.css" will overwrite the builtin "default.css".
  293. html_static_path = ['sphinx-static']
  294. # Add any extra paths that contain custom files (such as robots.txt or
  295. # .htaccess) here, relative to this directory. These files are copied
  296. # directly to the root of the documentation.
  297. #html_extra_path = []
  298. # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
  299. # using the given strftime format.
  300. #html_last_updated_fmt = '%b %d, %Y'
  301. # If true, SmartyPants will be used to convert quotes and dashes to
  302. # typographically correct entities.
  303. html_use_smartypants = False
  304. # Custom sidebar templates, maps document names to template names.
  305. # Note that the RTD theme ignores this.
  306. html_sidebars = { '**': ['searchbox.html', 'localtoc.html', 'sourcelink.html']}
  307. # Additional templates that should be rendered to pages, maps page names to
  308. # template names.
  309. #html_additional_pages = {}
  310. # If false, no module index is generated.
  311. #html_domain_indices = True
  312. # If false, no index is generated.
  313. #html_use_index = True
  314. # If true, the index is split into individual pages for each letter.
  315. #html_split_index = False
  316. # If true, links to the reST sources are added to the pages.
  317. #html_show_sourcelink = True
  318. # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
  319. #html_show_sphinx = True
  320. # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
  321. #html_show_copyright = True
  322. # If true, an OpenSearch description file will be output, and all pages will
  323. # contain a <link> tag referring to it. The value of this option must be the
  324. # base URL from which the finished HTML is served.
  325. #html_use_opensearch = ''
  326. # This is the file name suffix for HTML files (e.g. ".xhtml").
  327. #html_file_suffix = None
  328. # Language to be used for generating the HTML full-text search index.
  329. # Sphinx supports the following languages:
  330. # 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
  331. # 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
  332. #html_search_language = 'en'
  333. # A dictionary with options for the search language support, empty by default.
  334. # Now only 'ja' uses this config value
  335. #html_search_options = {'type': 'default'}
  336. # The name of a javascript file (relative to the configuration directory) that
  337. # implements a search results scorer. If empty, the default will be used.
  338. #html_search_scorer = 'scorer.js'
  339. # Output file base name for HTML help builder.
  340. htmlhelp_basename = 'TheLinuxKerneldoc'
  341. # -- Options for LaTeX output ---------------------------------------------
  342. latex_elements = {
  343. # The paper size ('letterpaper' or 'a4paper').
  344. 'papersize': 'a4paper',
  345. # The font size ('10pt', '11pt' or '12pt').
  346. 'pointsize': '11pt',
  347. # Latex figure (float) alignment
  348. #'figure_align': 'htbp',
  349. # Don't mangle with UTF-8 chars
  350. 'inputenc': '',
  351. 'utf8extra': '',
  352. # Set document margins
  353. 'sphinxsetup': '''
  354. hmargin=0.5in, vmargin=1in,
  355. parsedliteralwraps=true,
  356. verbatimhintsturnover=false,
  357. ''',
  358. # For CJK One-half spacing, need to be in front of hyperref
  359. 'extrapackages': r'\usepackage{setspace}',
  360. # Additional stuff for the LaTeX preamble.
  361. 'preamble': '''
  362. % Use some font with UTF-8 support with XeLaTeX
  363. \\usepackage{fontspec}
  364. \\setsansfont{DejaVu Sans}
  365. \\setromanfont{DejaVu Serif}
  366. \\setmonofont{DejaVu Sans Mono}
  367. ''',
  368. }
  369. # Fix reference escape troubles with Sphinx 1.4.x
  370. if major == 1:
  371. latex_elements['preamble'] += '\\renewcommand*{\\DUrole}[2]{ #2 }\n'
  372. # Load kerneldoc specific LaTeX settings
  373. latex_elements['preamble'] += '''
  374. % Load kerneldoc specific LaTeX settings
  375. \\input{kerneldoc-preamble.sty}
  376. '''
  377. # With Sphinx 1.6, it is possible to change the Bg color directly
  378. # by using:
  379. # \definecolor{sphinxnoteBgColor}{RGB}{204,255,255}
  380. # \definecolor{sphinxwarningBgColor}{RGB}{255,204,204}
  381. # \definecolor{sphinxattentionBgColor}{RGB}{255,255,204}
  382. # \definecolor{sphinximportantBgColor}{RGB}{192,255,204}
  383. #
  384. # However, it require to use sphinx heavy box with:
  385. #
  386. # \renewenvironment{sphinxlightbox} {%
  387. # \\begin{sphinxheavybox}
  388. # }
  389. # \\end{sphinxheavybox}
  390. # }
  391. #
  392. # Unfortunately, the implementation is buggy: if a note is inside a
  393. # table, it isn't displayed well. So, for now, let's use boring
  394. # black and white notes.
  395. # Grouping the document tree into LaTeX files. List of tuples
  396. # (source start file, target name, title,
  397. # author, documentclass [howto, manual, or own class]).
  398. # Sorted in alphabetical order
  399. latex_documents = [
  400. ]
  401. # Add all other index files from Documentation/ subdirectories
  402. for fn in os.listdir('.'):
  403. doc = os.path.join(fn, "index")
  404. if os.path.exists(doc + ".rst"):
  405. has = False
  406. for l in latex_documents:
  407. if l[0] == doc:
  408. has = True
  409. break
  410. if not has:
  411. latex_documents.append((doc, fn + '.tex',
  412. 'Linux %s Documentation' % fn.capitalize(),
  413. 'The kernel development community',
  414. 'manual'))
  415. # The name of an image file (relative to this directory) to place at the top of
  416. # the title page.
  417. #latex_logo = None
  418. # For "manual" documents, if this is true, then toplevel headings are parts,
  419. # not chapters.
  420. #latex_use_parts = False
  421. # If true, show page references after internal links.
  422. #latex_show_pagerefs = False
  423. # If true, show URL addresses after external links.
  424. #latex_show_urls = False
  425. # Documents to append as an appendix to all manuals.
  426. #latex_appendices = []
  427. # If false, no module index is generated.
  428. #latex_domain_indices = True
  429. # Additional LaTeX stuff to be copied to build directory
  430. latex_additional_files = [
  431. 'sphinx/kerneldoc-preamble.sty',
  432. ]
  433. # -- Options for manual page output ---------------------------------------
  434. # One entry per manual page. List of tuples
  435. # (source start file, name, description, authors, manual section).
  436. man_pages = [
  437. (master_doc, 'thelinuxkernel', 'The Linux Kernel Documentation',
  438. [author], 1)
  439. ]
  440. # If true, show URL addresses after external links.
  441. #man_show_urls = False
  442. # -- Options for Texinfo output -------------------------------------------
  443. # Grouping the document tree into Texinfo files. List of tuples
  444. # (source start file, target name, title, author,
  445. # dir menu entry, description, category)
  446. texinfo_documents = [
  447. (master_doc, 'TheLinuxKernel', 'The Linux Kernel Documentation',
  448. author, 'TheLinuxKernel', 'One line description of project.',
  449. 'Miscellaneous'),
  450. ]
  451. # Documents to append as an appendix to all manuals.
  452. #texinfo_appendices = []
  453. # If false, no module index is generated.
  454. #texinfo_domain_indices = True
  455. # How to display URL addresses: 'footnote', 'no', or 'inline'.
  456. #texinfo_show_urls = 'footnote'
  457. # If true, do not generate a @detailmenu in the "Top" node's menu.
  458. #texinfo_no_detailmenu = False
  459. # -- Options for Epub output ----------------------------------------------
  460. # Bibliographic Dublin Core info.
  461. epub_title = project
  462. epub_author = author
  463. epub_publisher = author
  464. epub_copyright = copyright
  465. # The basename for the epub file. It defaults to the project name.
  466. #epub_basename = project
  467. # The HTML theme for the epub output. Since the default themes are not
  468. # optimized for small screen space, using the same theme for HTML and epub
  469. # output is usually not wise. This defaults to 'epub', a theme designed to save
  470. # visual space.
  471. #epub_theme = 'epub'
  472. # The language of the text. It defaults to the language option
  473. # or 'en' if the language is not set.
  474. #epub_language = ''
  475. # The scheme of the identifier. Typical schemes are ISBN or URL.
  476. #epub_scheme = ''
  477. # The unique identifier of the text. This can be a ISBN number
  478. # or the project homepage.
  479. #epub_identifier = ''
  480. # A unique identification for the text.
  481. #epub_uid = ''
  482. # A tuple containing the cover image and cover page html template filenames.
  483. #epub_cover = ()
  484. # A sequence of (type, uri, title) tuples for the guide element of content.opf.
  485. #epub_guide = ()
  486. # HTML files that should be inserted before the pages created by sphinx.
  487. # The format is a list of tuples containing the path and title.
  488. #epub_pre_files = []
  489. # HTML files that should be inserted after the pages created by sphinx.
  490. # The format is a list of tuples containing the path and title.
  491. #epub_post_files = []
  492. # A list of files that should not be packed into the epub file.
  493. epub_exclude_files = ['search.html']
  494. # The depth of the table of contents in toc.ncx.
  495. #epub_tocdepth = 3
  496. # Allow duplicate toc entries.
  497. #epub_tocdup = True
  498. # Choose between 'default' and 'includehidden'.
  499. #epub_tocscope = 'default'
  500. # Fix unsupported image types using the Pillow.
  501. #epub_fix_images = False
  502. # Scale large images.
  503. #epub_max_image_width = 0
  504. # How to display URL addresses: 'footnote', 'no', or 'inline'.
  505. #epub_show_urls = 'inline'
  506. # If false, no index is generated.
  507. #epub_use_index = True
  508. #=======
  509. # rst2pdf
  510. #
  511. # Grouping the document tree into PDF files. List of tuples
  512. # (source start file, target name, title, author, options).
  513. #
  514. # See the Sphinx chapter of https://ralsina.me/static/manual.pdf
  515. #
  516. # FIXME: Do not add the index file here; the result will be too big. Adding
  517. # multiple PDF files here actually tries to get the cross-referencing right
  518. # *between* PDF files.
  519. pdf_documents = [
  520. ('kernel-documentation', u'Kernel', u'Kernel', u'J. Random Bozo'),
  521. ]
  522. # kernel-doc extension configuration for running Sphinx directly (e.g. by Read
  523. # the Docs). In a normal build, these are supplied from the Makefile via command
  524. # line arguments.
  525. kerneldoc_bin = '../scripts/kernel-doc'
  526. kerneldoc_srctree = '..'
  527. # ------------------------------------------------------------------------------
  528. # Since loadConfig overwrites settings from the global namespace, it has to be
  529. # the last statement in the conf.py file
  530. # ------------------------------------------------------------------------------
  531. loadConfig(globals())