conf.py 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  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 distutils.version import LooseVersion
  32. from sphinx.errors import ConfigError
  33. # Make Sphinx fail cleanly if using an old Python, rather than obscurely
  34. # failing because some code in one of our extensions doesn't work there.
  35. # In newer versions of Sphinx this will display nicely; in older versions
  36. # Sphinx will also produce a Python backtrace but at least the information
  37. # gets printed...
  38. if sys.version_info < (3,6):
  39. raise ConfigError(
  40. "QEMU requires a Sphinx that uses Python 3.6 or better\n")
  41. # The per-manual conf.py will set qemu_docdir for a single-manual build;
  42. # otherwise set it here if this is an entire-manual-set build.
  43. # This is always the absolute path of the docs/ directory in the source tree.
  44. try:
  45. qemu_docdir
  46. except NameError:
  47. qemu_docdir = os.path.abspath(".")
  48. # If extensions (or modules to document with autodoc) are in another directory,
  49. # add these directories to sys.path here. If the directory is relative to the
  50. # documentation root, use an absolute path starting from qemu_docdir.
  51. #
  52. # Our extensions are in docs/sphinx; the qapidoc extension requires
  53. # the QAPI modules from scripts/.
  54. sys.path.insert(0, os.path.join(qemu_docdir, "sphinx"))
  55. sys.path.insert(0, os.path.join(qemu_docdir, "../scripts"))
  56. # -- General configuration ------------------------------------------------
  57. # If your documentation needs a minimal Sphinx version, state it here.
  58. #
  59. # Sphinx 1.5 and earlier can't build our docs because they are too
  60. # picky about the syntax of the argument to the option:: directive
  61. # (see Sphinx bugs #646, #3366).
  62. needs_sphinx = '1.6'
  63. # Add any Sphinx extension module names here, as strings. They can be
  64. # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
  65. # ones.
  66. extensions = ['kerneldoc', 'qmp_lexer', 'hxtool', 'depfile', 'qapidoc']
  67. if sphinx.version_info[:3] > (4, 0, 0):
  68. tags.add('sphinx4')
  69. extensions += ['dbusdoc']
  70. else:
  71. extensions += ['fakedbusdoc']
  72. # Add any paths that contain templates here, relative to this directory.
  73. templates_path = [os.path.join(qemu_docdir, '_templates')]
  74. # The suffix(es) of source filenames.
  75. # You can specify multiple suffix as a list of string:
  76. #
  77. # source_suffix = ['.rst', '.md']
  78. source_suffix = '.rst'
  79. # The master toctree document.
  80. master_doc = 'index'
  81. # Interpret `single-backticks` to be a cross-reference to any kind of
  82. # referenceable object. Unresolvable or ambiguous references will emit a
  83. # warning at build time.
  84. default_role = 'any'
  85. # General information about the project.
  86. project = u'QEMU'
  87. copyright = u'2022, The QEMU Project Developers'
  88. author = u'The QEMU Project Developers'
  89. # The version info for the project you're documenting, acts as replacement for
  90. # |version| and |release|, also used in various other places throughout the
  91. # built documents.
  92. # Extract this information from the VERSION file, for the benefit of
  93. # standalone Sphinx runs as used by readthedocs.org. Builds run from
  94. # the Makefile will pass version and release on the sphinx-build
  95. # command line, which override this.
  96. try:
  97. extracted_version = None
  98. with open(os.path.join(qemu_docdir, '../VERSION')) as f:
  99. extracted_version = f.readline().strip()
  100. except:
  101. pass
  102. finally:
  103. if extracted_version:
  104. version = release = extracted_version
  105. else:
  106. version = release = "unknown version"
  107. # The language for content autogenerated by Sphinx. Refer to documentation
  108. # for a list of supported languages.
  109. #
  110. # This is also used if you do content translation via gettext catalogs.
  111. # Usually you set "language" from the command line for these cases.
  112. language = None
  113. # List of patterns, relative to source directory, that match files and
  114. # directories to ignore when looking for source files.
  115. # This patterns also effect to html_static_path and html_extra_path
  116. exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
  117. # The name of the Pygments (syntax highlighting) style to use.
  118. pygments_style = 'sphinx'
  119. # If true, `todo` and `todoList` produce output, else they produce nothing.
  120. todo_include_todos = False
  121. # Sphinx defaults to warning about use of :option: for options not defined
  122. # with "option::" in the document being processed. Turn that off.
  123. suppress_warnings = ["ref.option"]
  124. # The rst_epilog fragment is effectively included in every rST file.
  125. # We use it to define substitutions based on build config that
  126. # can then be used in the documentation. The fallback if the
  127. # environment variable is not set is for the benefit of readthedocs
  128. # style document building; our Makefile always sets the variable.
  129. confdir = os.getenv('CONFDIR', "/etc/qemu")
  130. rst_epilog = ".. |CONFDIR| replace:: ``" + confdir + "``\n"
  131. # We slurp in the defs.rst.inc and literally include it into rst_epilog,
  132. # because Sphinx's include:: directive doesn't work with absolute paths
  133. # and there isn't any one single relative path that will work for all
  134. # documents and for both via-make and direct sphinx-build invocation.
  135. with open(os.path.join(qemu_docdir, 'defs.rst.inc')) as f:
  136. rst_epilog += f.read()
  137. # -- Options for HTML output ----------------------------------------------
  138. # The theme to use for HTML and HTML Help pages. See the documentation for
  139. # a list of builtin themes.
  140. #
  141. try:
  142. import sphinx_rtd_theme
  143. except ImportError:
  144. raise ConfigError(
  145. 'The Sphinx \'sphinx_rtd_theme\' HTML theme was not found.\n'
  146. )
  147. html_theme = 'sphinx_rtd_theme'
  148. # Theme options are theme-specific and customize the look and feel of a theme
  149. # further. For a list of options available for each theme, see the
  150. # documentation.
  151. if LooseVersion(sphinx_rtd_theme.__version__) >= LooseVersion("0.4.3"):
  152. html_theme_options = {
  153. "style_nav_header_background": "#802400",
  154. "navigation_with_keys": True,
  155. }
  156. html_logo = os.path.join(qemu_docdir, "../ui/icons/qemu_128x128.png")
  157. html_favicon = os.path.join(qemu_docdir, "../ui/icons/qemu_32x32.png")
  158. # Add any paths that contain custom static files (such as style sheets) here,
  159. # relative to this directory. They are copied after the builtin static files,
  160. # so a file named "default.css" will overwrite the builtin "default.css".
  161. html_static_path = [os.path.join(qemu_docdir, "sphinx-static")]
  162. html_css_files = [
  163. 'theme_overrides.css',
  164. ]
  165. html_js_files = [
  166. 'custom.js',
  167. ]
  168. html_context = {
  169. "display_gitlab": True,
  170. "gitlab_user": "qemu-project",
  171. "gitlab_repo": "qemu",
  172. "gitlab_version": "master",
  173. "conf_py_path": "/docs/", # Path in the checkout to the docs root
  174. }
  175. # Custom sidebar templates, must be a dictionary that maps document names
  176. # to template names.
  177. #html_sidebars = {}
  178. # Don't copy the rST source files to the HTML output directory,
  179. # and don't put links to the sources into the output HTML.
  180. html_copy_source = False
  181. # -- Options for HTMLHelp output ------------------------------------------
  182. # Output file base name for HTML help builder.
  183. htmlhelp_basename = 'QEMUdoc'
  184. # -- Options for LaTeX output ---------------------------------------------
  185. latex_elements = {
  186. # The paper size ('letterpaper' or 'a4paper').
  187. #
  188. # 'papersize': 'letterpaper',
  189. # The font size ('10pt', '11pt' or '12pt').
  190. #
  191. # 'pointsize': '10pt',
  192. # Additional stuff for the LaTeX preamble.
  193. #
  194. # 'preamble': '',
  195. # Latex figure (float) alignment
  196. #
  197. # 'figure_align': 'htbp',
  198. }
  199. # Grouping the document tree into LaTeX files. List of tuples
  200. # (source start file, target name, title,
  201. # author, documentclass [howto, manual, or own class]).
  202. latex_documents = [
  203. (master_doc, 'QEMU.tex', u'QEMU Documentation',
  204. u'The QEMU Project Developers', 'manual'),
  205. ]
  206. # -- Options for manual page output ---------------------------------------
  207. # Individual manual/conf.py can override this to create man pages
  208. man_pages = [
  209. ('interop/qemu-ga', 'qemu-ga',
  210. 'QEMU Guest Agent',
  211. ['Michael Roth <mdroth@linux.vnet.ibm.com>'], 8),
  212. ('interop/qemu-ga-ref', 'qemu-ga-ref',
  213. 'QEMU Guest Agent Protocol Reference',
  214. [], 7),
  215. ('interop/qemu-qmp-ref', 'qemu-qmp-ref',
  216. 'QEMU QMP Reference Manual',
  217. [], 7),
  218. ('interop/qemu-storage-daemon-qmp-ref', 'qemu-storage-daemon-qmp-ref',
  219. 'QEMU Storage Daemon QMP Reference Manual',
  220. [], 7),
  221. ('system/qemu-manpage', 'qemu',
  222. 'QEMU User Documentation',
  223. ['Fabrice Bellard'], 1),
  224. ('system/qemu-block-drivers', 'qemu-block-drivers',
  225. 'QEMU block drivers reference',
  226. ['Fabrice Bellard and the QEMU Project developers'], 7),
  227. ('system/qemu-cpu-models', 'qemu-cpu-models',
  228. 'QEMU CPU Models',
  229. ['The QEMU Project developers'], 7),
  230. ('tools/qemu-img', 'qemu-img',
  231. 'QEMU disk image utility',
  232. ['Fabrice Bellard'], 1),
  233. ('tools/qemu-nbd', 'qemu-nbd',
  234. 'QEMU Disk Network Block Device Server',
  235. ['Anthony Liguori <anthony@codemonkey.ws>'], 8),
  236. ('tools/qemu-pr-helper', 'qemu-pr-helper',
  237. 'QEMU persistent reservation helper',
  238. [], 8),
  239. ('tools/qemu-storage-daemon', 'qemu-storage-daemon',
  240. 'QEMU storage daemon',
  241. [], 1),
  242. ('tools/qemu-trace-stap', 'qemu-trace-stap',
  243. 'QEMU SystemTap trace tool',
  244. [], 1),
  245. ('tools/virtfs-proxy-helper', 'virtfs-proxy-helper',
  246. 'QEMU 9p virtfs proxy filesystem helper',
  247. ['M. Mohan Kumar'], 1),
  248. ('tools/virtiofsd', 'virtiofsd',
  249. 'QEMU virtio-fs shared file system daemon',
  250. ['Stefan Hajnoczi <stefanha@redhat.com>',
  251. 'Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>'], 1),
  252. ]
  253. man_make_section_directory = False
  254. # -- Options for Texinfo output -------------------------------------------
  255. # Grouping the document tree into Texinfo files. List of tuples
  256. # (source start file, target name, title, author,
  257. # dir menu entry, description, category)
  258. texinfo_documents = [
  259. (master_doc, 'QEMU', u'QEMU Documentation',
  260. author, 'QEMU', 'One line description of project.',
  261. 'Miscellaneous'),
  262. ]
  263. # We use paths starting from qemu_docdir here so that you can run
  264. # sphinx-build from anywhere and the kerneldoc extension can still
  265. # find everything.
  266. kerneldoc_bin = ['perl', os.path.join(qemu_docdir, '../scripts/kernel-doc')]
  267. kerneldoc_srctree = os.path.join(qemu_docdir, '..')
  268. hxtool_srctree = os.path.join(qemu_docdir, '..')
  269. qapidoc_srctree = os.path.join(qemu_docdir, '..')
  270. dbusdoc_srctree = os.path.join(qemu_docdir, '..')
  271. dbus_index_common_prefix = ["org.qemu."]