1 # -*- coding: utf-8 -*-
3 # The Linux Kernel documentation build configuration file, created by
4 # sphinx-quickstart on Fri Feb 12 13:51:46 2016.
6 # This file is execfile()d with the current directory set to its
9 # Note that not all possible configuration values are present in this
12 # All configuration values have a default; values that are commented out
13 # serve to show the default.
19 from subprocess
import check_output
22 major
, minor
, patch
= sphinx
.version_info
[:3]
25 # If extensions (or modules to document with autodoc) are in another directory,
26 # add these directories to sys.path here. If the directory is relative to the
27 # documentation root, use os.path.abspath to make it absolute, like shown here.
28 sys
.path
.insert(0, os
.path
.abspath('sphinx'))
29 from load_config
import loadConfig
31 # -- General configuration ------------------------------------------------
33 # If your documentation needs a minimal Sphinx version, state it here.
36 # Add any Sphinx extension module names here, as strings. They can be
37 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
39 extensions
= ['kerneldoc', 'rstFlatTable', 'kernel_include', 'cdomain',
40 'kfigure', 'sphinx.ext.ifconfig', 'automarkup',
41 'maintainers_include']
43 # The name of the math extension changed on Sphinx 1.4
44 if (major
== 1 and minor
> 3) or (major
> 1):
45 extensions
.append("sphinx.ext.imgmath")
47 extensions
.append("sphinx.ext.pngmath")
49 # Add any paths that contain templates here, relative to this directory.
50 templates_path
= ['_templates']
52 # The suffix(es) of source filenames.
53 # You can specify multiple suffix as a list of string:
54 # source_suffix = ['.rst', '.md']
55 source_suffix
= '.rst'
57 # The encoding of source files.
58 #source_encoding = 'utf-8-sig'
60 # The master toctree document.
63 # General information about the project.
64 project
= 'The Linux Kernel'
65 copyright
= 'The kernel development community'
66 author
= 'The kernel development community'
68 # The version info for the project you're documenting, acts as replacement for
69 # |version| and |release|, also used in various other places throughout the
72 # In a normal build, version and release are are set to KERNELVERSION and
73 # KERNELRELEASE, respectively, from the Makefile via Sphinx command line
76 # The following code tries to extract the information by reading the Makefile,
77 # when Sphinx is run directly (e.g. by Read the Docs).
79 makefile_version
= None
80 makefile_patchlevel
= None
81 for line
in open('../Makefile'):
82 key
, val
= [x
.strip() for x
in line
.split('=', 2)]
84 makefile_version
= val
85 elif key
== 'PATCHLEVEL':
86 makefile_patchlevel
= val
87 if makefile_version
and makefile_patchlevel
:
92 if makefile_version
and makefile_patchlevel
:
93 version
= release
= makefile_version
+ '.' + makefile_patchlevel
95 version
= release
= "unknown version"
97 # The language for content autogenerated by Sphinx. Refer to documentation
98 # for a list of supported languages.
100 # This is also used if you do content translation via gettext catalogs.
101 # Usually you set "language" from the command line for these cases.
104 # There are two options for replacing |today|: either, you set today to some
105 # non-false value, then it is used:
107 # Else, today_fmt is used as the format for a strftime call.
108 #today_fmt = '%B %d, %Y'
110 # List of patterns, relative to source directory, that match files and
111 # directories to ignore when looking for source files.
112 exclude_patterns
= ['output']
114 # The reST default role (used for this markup: `text`) to use for all
118 # If true, '()' will be appended to :func: etc. cross-reference text.
119 #add_function_parentheses = True
121 # If true, the current module name will be prepended to all description
122 # unit titles (such as .. function::).
123 #add_module_names = True
125 # If true, sectionauthor and moduleauthor directives will be shown in the
126 # output. They are ignored by default.
127 #show_authors = False
129 # The name of the Pygments (syntax highlighting) style to use.
130 pygments_style
= 'sphinx'
132 # A list of ignored prefixes for module index sorting.
133 #modindex_common_prefix = []
135 # If true, keep warnings as "system message" paragraphs in the built documents.
136 #keep_warnings = False
138 # If true, `todo` and `todoList` produce output, else they produce nothing.
139 todo_include_todos
= False
142 highlight_language
= 'none'
144 # -- Options for HTML output ----------------------------------------------
146 # The theme to use for HTML and HTML Help pages. See the documentation for
147 # a list of builtin themes.
149 # The Read the Docs theme is available from
150 # - https://github.com/snide/sphinx_rtd_theme
151 # - https://pypi.python.org/pypi/sphinx_rtd_theme
152 # - python-sphinx-rtd-theme package (on Debian)
154 import sphinx_rtd_theme
155 html_theme
= 'sphinx_rtd_theme'
156 html_theme_path
= [sphinx_rtd_theme
.get_html_theme_path()]
158 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')
160 # Theme options are theme-specific and customize the look and feel of a theme
161 # further. For a list of options available for each theme, see the
163 #html_theme_options = {}
165 # Add any paths that contain custom themes here, relative to this directory.
166 #html_theme_path = []
168 # The name for this set of Sphinx documents. If None, it defaults to
169 # "<project> v<release> documentation".
172 # A shorter title for the navigation bar. Default is the same as html_title.
173 #html_short_title = None
175 # The name of an image file (relative to this directory) to place at the top
179 # The name of an image file (within the static path) to use as favicon of the
180 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
184 # Add any paths that contain custom static files (such as style sheets) here,
185 # relative to this directory. They are copied after the builtin static files,
186 # so a file named "default.css" will overwrite the builtin "default.css".
188 html_static_path
= ['sphinx-static']
192 '_static/theme_overrides.css',
196 # Add any extra paths that contain custom files (such as robots.txt or
197 # .htaccess) here, relative to this directory. These files are copied
198 # directly to the root of the documentation.
199 #html_extra_path = []
201 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
202 # using the given strftime format.
203 #html_last_updated_fmt = '%b %d, %Y'
205 # If true, SmartyPants will be used to convert quotes and dashes to
206 # typographically correct entities.
207 html_use_smartypants
= False
209 # Custom sidebar templates, maps document names to template names.
212 # Additional templates that should be rendered to pages, maps page names to
214 #html_additional_pages = {}
216 # If false, no module index is generated.
217 #html_domain_indices = True
219 # If false, no index is generated.
220 #html_use_index = True
222 # If true, the index is split into individual pages for each letter.
223 #html_split_index = False
225 # If true, links to the reST sources are added to the pages.
226 #html_show_sourcelink = True
228 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
229 #html_show_sphinx = True
231 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
232 #html_show_copyright = True
234 # If true, an OpenSearch description file will be output, and all pages will
235 # contain a <link> tag referring to it. The value of this option must be the
236 # base URL from which the finished HTML is served.
237 #html_use_opensearch = ''
239 # This is the file name suffix for HTML files (e.g. ".xhtml").
240 #html_file_suffix = None
242 # Language to be used for generating the HTML full-text search index.
243 # Sphinx supports the following languages:
244 # 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
245 # 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
246 #html_search_language = 'en'
248 # A dictionary with options for the search language support, empty by default.
249 # Now only 'ja' uses this config value
250 #html_search_options = {'type': 'default'}
252 # The name of a javascript file (relative to the configuration directory) that
253 # implements a search results scorer. If empty, the default will be used.
254 #html_search_scorer = 'scorer.js'
256 # Output file base name for HTML help builder.
257 htmlhelp_basename
= 'TheLinuxKerneldoc'
259 # -- Options for LaTeX output ---------------------------------------------
262 # The paper size ('letterpaper' or 'a4paper').
263 'papersize': 'a4paper',
265 # The font size ('10pt', '11pt' or '12pt').
268 # Latex figure (float) alignment
269 #'figure_align': 'htbp',
271 # Don't mangle with UTF-8 chars
275 # Additional stuff for the LaTeX preamble.
277 % Use some font with UTF-8 support with XeLaTeX
278 \\usepackage{fontspec}
279 \\setsansfont{DejaVu Sans}
280 \\setromanfont{DejaVu Serif}
281 \\setmonofont{DejaVu Sans Mono}
285 # At least one book (translations) may have Asian characters
286 # with are only displayed if xeCJK is used
288 cjk_cmd
= check_output(['fc-list', '--format="%{family[0]}\n"']).decode('utf-8', 'ignore')
289 if cjk_cmd
.find("Noto Sans CJK SC") >= 0:
290 print ("enabling CJK for LaTeX builder")
291 latex_elements
['preamble'] += '''
292 % This is needed for translations
294 \\setCJKmainfont{Noto Sans CJK SC}
297 # Fix reference escape troubles with Sphinx 1.4.x
298 if major
== 1 and minor
> 3:
299 latex_elements
['preamble'] += '\\renewcommand*{\\DUrole}[2]{ #2 }\n'
301 if major
== 1 and minor
<= 4:
302 latex_elements
['preamble'] += '\\usepackage[margin=0.5in, top=1in, bottom=1in]{geometry}'
303 elif major
== 1 and (minor
> 5 or (minor
== 5 and patch
>= 3)):
304 latex_elements
['sphinxsetup'] = 'hmargin=0.5in, vmargin=1in'
305 latex_elements
['preamble'] += '\\fvset{fontsize=auto}\n'
307 # Customize notice background colors on Sphinx < 1.6:
308 if major
== 1 and minor
< 6:
309 latex_elements
['preamble'] += '''
312 % Put notes in color and let them be inside a table
313 \\definecolor{NoteColor}{RGB}{204,255,255}
314 \\definecolor{WarningColor}{RGB}{255,204,204}
315 \\definecolor{AttentionColor}{RGB}{255,255,204}
316 \\definecolor{ImportantColor}{RGB}{192,255,204}
317 \\definecolor{OtherColor}{RGB}{204,204,204}
318 \\newlength{\\mynoticelength}
319 \\makeatletter\\newenvironment{coloredbox}[1]{%
320 \\setlength{\\fboxrule}{1pt}
321 \\setlength{\\fboxsep}{7pt}
322 \\setlength{\\mynoticelength}{\\linewidth}
323 \\addtolength{\\mynoticelength}{-2\\fboxsep}
324 \\addtolength{\\mynoticelength}{-2\\fboxrule}
325 \\begin{lrbox}{\\@tempboxa}\\begin{minipage}{\\mynoticelength}}{\\end{minipage}\\end{lrbox}%
327 {\\equal{\\py@noticetype}{note}}%
328 {\\colorbox{NoteColor}{\\usebox{\\@tempboxa}}}%
331 {\\equal{\\py@noticetype}{warning}}%
332 {\\colorbox{WarningColor}{\\usebox{\\@tempboxa}}}%
335 {\\equal{\\py@noticetype}{attention}}%
336 {\\colorbox{AttentionColor}{\\usebox{\\@tempboxa}}}%
339 {\\equal{\\py@noticetype}{important}}%
340 {\\colorbox{ImportantColor}{\\usebox{\\@tempboxa}}}%
341 {\\colorbox{OtherColor}{\\usebox{\\@tempboxa}}}%
348 \\renewenvironment{notice}[2]{%
349 \\def\\py@noticetype{#1}
350 \\begin{coloredbox}{#1}
353 \\csname py@noticestart@#1\\endcsname
356 \\csname py@noticeend@\\py@noticetype\\endcsname
363 # With Sphinx 1.6, it is possible to change the Bg color directly
365 # \definecolor{sphinxnoteBgColor}{RGB}{204,255,255}
366 # \definecolor{sphinxwarningBgColor}{RGB}{255,204,204}
367 # \definecolor{sphinxattentionBgColor}{RGB}{255,255,204}
368 # \definecolor{sphinximportantBgColor}{RGB}{192,255,204}
370 # However, it require to use sphinx heavy box with:
372 # \renewenvironment{sphinxlightbox} {%
373 # \\begin{sphinxheavybox}
375 # \\end{sphinxheavybox}
378 # Unfortunately, the implementation is buggy: if a note is inside a
379 # table, it isn't displayed well. So, for now, let's use boring
380 # black and white notes.
382 # Grouping the document tree into LaTeX files. List of tuples
383 # (source start file, target name, title,
384 # author, documentclass [howto, manual, or own class]).
385 # Sorted in alphabetical order
387 ('admin-guide/index', 'linux-user.tex', 'Linux Kernel User Documentation',
388 'The kernel development community', 'manual'),
389 ('core-api/index', 'core-api.tex', 'The kernel core API manual',
390 'The kernel development community', 'manual'),
391 ('crypto/index', 'crypto-api.tex', 'Linux Kernel Crypto API manual',
392 'The kernel development community', 'manual'),
393 ('dev-tools/index', 'dev-tools.tex', 'Development tools for the Kernel',
394 'The kernel development community', 'manual'),
395 ('doc-guide/index', 'kernel-doc-guide.tex', 'Linux Kernel Documentation Guide',
396 'The kernel development community', 'manual'),
397 ('driver-api/index', 'driver-api.tex', 'The kernel driver API manual',
398 'The kernel development community', 'manual'),
399 ('filesystems/index', 'filesystems.tex', 'Linux Filesystems API',
400 'The kernel development community', 'manual'),
401 ('admin-guide/ext4', 'ext4-admin-guide.tex', 'ext4 Administration Guide',
402 'ext4 Community', 'manual'),
403 ('filesystems/ext4/index', 'ext4-data-structures.tex',
404 'ext4 Data Structures and Algorithms', 'ext4 Community', 'manual'),
405 ('gpu/index', 'gpu.tex', 'Linux GPU Driver Developer\'s Guide',
406 'The kernel development community', 'manual'),
407 ('input/index', 'linux-input.tex', 'The Linux input driver subsystem',
408 'The kernel development community', 'manual'),
409 ('kernel-hacking/index', 'kernel-hacking.tex', 'Unreliable Guide To Hacking The Linux Kernel',
410 'The kernel development community', 'manual'),
411 ('media/index', 'media.tex', 'Linux Media Subsystem Documentation',
412 'The kernel development community', 'manual'),
413 ('networking/index', 'networking.tex', 'Linux Networking Documentation',
414 'The kernel development community', 'manual'),
415 ('process/index', 'development-process.tex', 'Linux Kernel Development Documentation',
416 'The kernel development community', 'manual'),
417 ('security/index', 'security.tex', 'The kernel security subsystem manual',
418 'The kernel development community', 'manual'),
419 ('sh/index', 'sh.tex', 'SuperH architecture implementation manual',
420 'The kernel development community', 'manual'),
421 ('sound/index', 'sound.tex', 'Linux Sound Subsystem Documentation',
422 'The kernel development community', 'manual'),
423 ('userspace-api/index', 'userspace-api.tex', 'The Linux kernel user-space API guide',
424 'The kernel development community', 'manual'),
427 # Add all other index files from Documentation/ subdirectories
428 for fn
in os
.listdir('.'):
429 doc
= os
.path
.join(fn
, "index")
430 if os
.path
.exists(doc
+ ".rst"):
432 for l
in latex_documents
:
437 latex_documents
.append((doc
, fn
+ '.tex',
438 'Linux %s Documentation' % fn
.capitalize(),
439 'The kernel development community',
442 # The name of an image file (relative to this directory) to place at the top of
446 # For "manual" documents, if this is true, then toplevel headings are parts,
448 #latex_use_parts = False
450 # If true, show page references after internal links.
451 #latex_show_pagerefs = False
453 # If true, show URL addresses after external links.
454 #latex_show_urls = False
456 # Documents to append as an appendix to all manuals.
457 #latex_appendices = []
459 # If false, no module index is generated.
460 #latex_domain_indices = True
463 # -- Options for manual page output ---------------------------------------
465 # One entry per manual page. List of tuples
466 # (source start file, name, description, authors, manual section).
468 (master_doc
, 'thelinuxkernel', 'The Linux Kernel Documentation',
472 # If true, show URL addresses after external links.
473 #man_show_urls = False
476 # -- Options for Texinfo output -------------------------------------------
478 # Grouping the document tree into Texinfo files. List of tuples
479 # (source start file, target name, title, author,
480 # dir menu entry, description, category)
481 texinfo_documents
= [
482 (master_doc
, 'TheLinuxKernel', 'The Linux Kernel Documentation',
483 author
, 'TheLinuxKernel', 'One line description of project.',
487 # Documents to append as an appendix to all manuals.
488 #texinfo_appendices = []
490 # If false, no module index is generated.
491 #texinfo_domain_indices = True
493 # How to display URL addresses: 'footnote', 'no', or 'inline'.
494 #texinfo_show_urls = 'footnote'
496 # If true, do not generate a @detailmenu in the "Top" node's menu.
497 #texinfo_no_detailmenu = False
500 # -- Options for Epub output ----------------------------------------------
502 # Bibliographic Dublin Core info.
505 epub_publisher
= author
506 epub_copyright
= copyright
508 # The basename for the epub file. It defaults to the project name.
509 #epub_basename = project
511 # The HTML theme for the epub output. Since the default themes are not
512 # optimized for small screen space, using the same theme for HTML and epub
513 # output is usually not wise. This defaults to 'epub', a theme designed to save
517 # The language of the text. It defaults to the language option
518 # or 'en' if the language is not set.
521 # The scheme of the identifier. Typical schemes are ISBN or URL.
524 # The unique identifier of the text. This can be a ISBN number
525 # or the project homepage.
526 #epub_identifier = ''
528 # A unique identification for the text.
531 # A tuple containing the cover image and cover page html template filenames.
534 # A sequence of (type, uri, title) tuples for the guide element of content.opf.
537 # HTML files that should be inserted before the pages created by sphinx.
538 # The format is a list of tuples containing the path and title.
541 # HTML files that should be inserted after the pages created by sphinx.
542 # The format is a list of tuples containing the path and title.
543 #epub_post_files = []
545 # A list of files that should not be packed into the epub file.
546 epub_exclude_files
= ['search.html']
548 # The depth of the table of contents in toc.ncx.
551 # Allow duplicate toc entries.
554 # Choose between 'default' and 'includehidden'.
555 #epub_tocscope = 'default'
557 # Fix unsupported image types using the Pillow.
558 #epub_fix_images = False
560 # Scale large images.
561 #epub_max_image_width = 0
563 # How to display URL addresses: 'footnote', 'no', or 'inline'.
564 #epub_show_urls = 'inline'
566 # If false, no index is generated.
567 #epub_use_index = True
572 # Grouping the document tree into PDF files. List of tuples
573 # (source start file, target name, title, author, options).
575 # See the Sphinx chapter of http://ralsina.me/static/manual.pdf
577 # FIXME: Do not add the index file here; the result will be too big. Adding
578 # multiple PDF files here actually tries to get the cross-referencing right
579 # *between* PDF files.
581 ('kernel-documentation', u
'Kernel', u
'Kernel', u
'J. Random Bozo'),
584 # kernel-doc extension configuration for running Sphinx directly (e.g. by Read
585 # the Docs). In a normal build, these are supplied from the Makefile via command
587 kerneldoc_bin
= '../scripts/kernel-doc'
588 kerneldoc_srctree
= '..'
590 # ------------------------------------------------------------------------------
591 # Since loadConfig overwrites settings from the global namespace, it has to be
592 # the last statement in the conf.py file
593 # ------------------------------------------------------------------------------
594 loadConfig(globals())