conf.py 9.9 KB

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