conf.py 10 KB

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