conf.py 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. # -*- coding: utf-8 -*-
  2. #
  3. # QEMU documentation build configuration file, created by
  4. # sphinx-quickstart on Thu Jan 31 16:40:14 2019.
  5. #
  6. # This config file can be used in one of two ways:
  7. # (1) as a common config file which is included by the conf.py
  8. # for each of QEMU's manuals: in this case sphinx-build is run multiple
  9. # times, once per subdirectory.
  10. # (2) as a top level conf file which will result in building all
  11. # the manuals into a single document: in this case sphinx-build is
  12. # run once, on the top-level docs directory.
  13. #
  14. # QEMU's makefiles take option (1), which allows us to install
  15. # only the ones the user cares about (in particular we don't want
  16. # to ship the 'devel' manual to end-users).
  17. # Third-party sites such as readthedocs.org will take option (2).
  18. #
  19. #
  20. # This file is execfile()d with the current directory set to its
  21. # containing dir.
  22. #
  23. # Note that not all possible configuration values are present in this
  24. # autogenerated file.
  25. #
  26. # All configuration values have a default; values that are commented out
  27. # serve to show the default.
  28. import os
  29. import sys
  30. import sphinx
  31. from sphinx.errors import ConfigError
  32. # Make Sphinx fail cleanly if using an old Python, rather than obscurely
  33. # failing because some code in one of our extensions doesn't work there.
  34. # In newer versions of Sphinx this will display nicely; in older versions
  35. # Sphinx will also produce a Python backtrace but at least the information
  36. # gets printed...
  37. if sys.version_info < (3,5):
  38. raise ConfigError(
  39. "QEMU requires a Sphinx that uses Python 3.5 or better\n")
  40. # The per-manual conf.py will set qemu_docdir for a single-manual build;
  41. # otherwise set it here if this is an entire-manual-set build.
  42. # This is always the absolute path of the docs/ directory in the source tree.
  43. try:
  44. qemu_docdir
  45. except NameError:
  46. qemu_docdir = os.path.abspath(".")
  47. # If extensions (or modules to document with autodoc) are in another directory,
  48. # add these directories to sys.path here. If the directory is relative to the
  49. # documentation root, use an absolute path starting from qemu_docdir.
  50. #
  51. sys.path.insert(0, os.path.join(qemu_docdir, "sphinx"))
  52. # -- General configuration ------------------------------------------------
  53. # If your documentation needs a minimal Sphinx version, state it here.
  54. #
  55. # Sphinx 1.5 and earlier can't build our docs because they are too
  56. # picky about the syntax of the argument to the option:: directive
  57. # (see Sphinx bugs #646, #3366).
  58. needs_sphinx = '1.6'
  59. # Add any Sphinx extension module names here, as strings. They can be
  60. # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
  61. # ones.
  62. extensions = ['kerneldoc', 'qmp_lexer', 'hxtool']
  63. # Add any paths that contain templates here, relative to this directory.
  64. templates_path = ['_templates']
  65. # The suffix(es) of source filenames.
  66. # You can specify multiple suffix as a list of string:
  67. #
  68. # source_suffix = ['.rst', '.md']
  69. source_suffix = '.rst'
  70. # The master toctree document.
  71. master_doc = 'index'
  72. # General information about the project.
  73. project = u'QEMU'
  74. copyright = u'2020, The QEMU Project Developers'
  75. author = u'The QEMU Project Developers'
  76. # The version info for the project you're documenting, acts as replacement for
  77. # |version| and |release|, also used in various other places throughout the
  78. # built documents.
  79. # Extract this information from the VERSION file, for the benefit of
  80. # standalone Sphinx runs as used by readthedocs.org. Builds run from
  81. # the Makefile will pass version and release on the sphinx-build
  82. # command line, which override this.
  83. try:
  84. extracted_version = None
  85. with open(os.path.join(qemu_docdir, '../VERSION')) as f:
  86. extracted_version = f.readline().strip()
  87. except:
  88. pass
  89. finally:
  90. if extracted_version:
  91. version = release = extracted_version
  92. else:
  93. version = release = "unknown version"
  94. # The language for content autogenerated by Sphinx. Refer to documentation
  95. # for a list of supported languages.
  96. #
  97. # This is also used if you do content translation via gettext catalogs.
  98. # Usually you set "language" from the command line for these cases.
  99. language = None
  100. # List of patterns, relative to source directory, that match files and
  101. # directories to ignore when looking for source files.
  102. # This patterns also effect to html_static_path and html_extra_path
  103. exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
  104. # The name of the Pygments (syntax highlighting) style to use.
  105. pygments_style = 'sphinx'
  106. # If true, `todo` and `todoList` produce output, else they produce nothing.
  107. todo_include_todos = False
  108. # Sphinx defaults to warning about use of :option: for options not defined
  109. # with "option::" in the document being processed. Turn that off.
  110. suppress_warnings = ["ref.option"]
  111. # The rst_epilog fragment is effectively included in every rST file.
  112. # We use it to define substitutions based on build config that
  113. # can then be used in the documentation. The fallback if the
  114. # environment variable is not set is for the benefit of readthedocs
  115. # style document building; our Makefile always sets the variable.
  116. confdir = os.getenv('CONFDIR', "/etc/qemu")
  117. rst_epilog = ".. |CONFDIR| replace:: ``" + confdir + "``\n"
  118. # We slurp in the defs.rst.inc and literally include it into rst_epilog,
  119. # because Sphinx's include:: directive doesn't work with absolute paths
  120. # and there isn't any one single relative path that will work for all
  121. # documents and for both via-make and direct sphinx-build invocation.
  122. with open(os.path.join(qemu_docdir, 'defs.rst.inc')) as f:
  123. rst_epilog += f.read()
  124. # -- Options for HTML output ----------------------------------------------
  125. # The theme to use for HTML and HTML Help pages. See the documentation for
  126. # a list of builtin themes.
  127. #
  128. html_theme = 'alabaster'
  129. # Theme options are theme-specific and customize the look and feel of a theme
  130. # further. For a list of options available for each theme, see the
  131. # documentation.
  132. # We initialize this to empty here, so the per-manual conf.py can just
  133. # add individual key/value entries.
  134. html_theme_options = {
  135. }
  136. # Add any paths that contain custom static files (such as style sheets) here,
  137. # relative to this directory. They are copied after the builtin static files,
  138. # so a file named "default.css" will overwrite the builtin "default.css".
  139. # QEMU doesn't yet have any static files, so comment this out so we don't
  140. # get a warning about a missing directory.
  141. # If we do ever add this then it would probably be better to call the
  142. # subdirectory sphinx_static, as the Linux kernel does.
  143. # html_static_path = ['_static']
  144. # Custom sidebar templates, must be a dictionary that maps document names
  145. # to template names.
  146. #
  147. # This is required for the alabaster theme
  148. # refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
  149. html_sidebars = {
  150. '**': [
  151. 'about.html',
  152. 'navigation.html',
  153. 'searchbox.html',
  154. ]
  155. }
  156. # Don't copy the rST source files to the HTML output directory,
  157. # and don't put links to the sources into the output HTML.
  158. html_copy_source = False
  159. # -- Options for HTMLHelp output ------------------------------------------
  160. # Output file base name for HTML help builder.
  161. htmlhelp_basename = 'QEMUdoc'
  162. # -- Options for LaTeX output ---------------------------------------------
  163. latex_elements = {
  164. # The paper size ('letterpaper' or 'a4paper').
  165. #
  166. # 'papersize': 'letterpaper',
  167. # The font size ('10pt', '11pt' or '12pt').
  168. #
  169. # 'pointsize': '10pt',
  170. # Additional stuff for the LaTeX preamble.
  171. #
  172. # 'preamble': '',
  173. # Latex figure (float) alignment
  174. #
  175. # 'figure_align': 'htbp',
  176. }
  177. # Grouping the document tree into LaTeX files. List of tuples
  178. # (source start file, target name, title,
  179. # author, documentclass [howto, manual, or own class]).
  180. latex_documents = [
  181. (master_doc, 'QEMU.tex', u'QEMU Documentation',
  182. u'The QEMU Project Developers', 'manual'),
  183. ]
  184. # -- Options for manual page output ---------------------------------------
  185. # Individual manual/conf.py can override this to create man pages
  186. man_pages = []
  187. # -- Options for Texinfo output -------------------------------------------
  188. # Grouping the document tree into Texinfo files. List of tuples
  189. # (source start file, target name, title, author,
  190. # dir menu entry, description, category)
  191. texinfo_documents = [
  192. (master_doc, 'QEMU', u'QEMU Documentation',
  193. author, 'QEMU', 'One line description of project.',
  194. 'Miscellaneous'),
  195. ]
  196. # We use paths starting from qemu_docdir here so that you can run
  197. # sphinx-build from anywhere and the kerneldoc extension can still
  198. # find everything.
  199. kerneldoc_bin = os.path.join(qemu_docdir, '../scripts/kernel-doc')
  200. kerneldoc_srctree = os.path.join(qemu_docdir, '..')
  201. hxtool_srctree = os.path.join(qemu_docdir, '..')