conf.py 10 KB

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