conf.py 16 KB

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