Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 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 | # |
Peter Maydell | f8cf714 | 2019-03-07 14:26:46 +0000 | [diff] [blame] | 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 | # |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 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 | |
Peter Maydell | f8cf714 | 2019-03-07 14:26:46 +0000 | [diff] [blame] | 29 | import os |
| 30 | import sys |
Peter Maydell | 758b617 | 2020-02-13 17:56:19 +0000 | [diff] [blame] | 31 | import sphinx |
Peter Maydell | e22684e | 2020-03-30 13:18:59 +0100 | [diff] [blame] | 32 | from sphinx.errors import ConfigError |
Peter Maydell | 758b617 | 2020-02-13 17:56:19 +0000 | [diff] [blame] | 33 | |
Peter Maydell | f8cf714 | 2019-03-07 14:26:46 +0000 | [diff] [blame] | 34 | # The per-manual conf.py will set qemu_docdir for a single-manual build; |
| 35 | # otherwise set it here if this is an entire-manual-set build. |
| 36 | # This is always the absolute path of the docs/ directory in the source tree. |
| 37 | try: |
| 38 | qemu_docdir |
| 39 | except NameError: |
| 40 | qemu_docdir = os.path.abspath(".") |
| 41 | |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 42 | # If extensions (or modules to document with autodoc) are in another directory, |
| 43 | # add these directories to sys.path here. If the directory is relative to the |
Peter Maydell | f8cf714 | 2019-03-07 14:26:46 +0000 | [diff] [blame] | 44 | # documentation root, use an absolute path starting from qemu_docdir. |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 45 | # |
Peter Maydell | 4078ee5 | 2020-09-25 17:23:02 +0100 | [diff] [blame] | 46 | # Our extensions are in docs/sphinx; the qapidoc extension requires |
| 47 | # the QAPI modules from scripts/. |
John Snow | cd231e1 | 2019-07-10 15:08:06 -0400 | [diff] [blame] | 48 | sys.path.insert(0, os.path.join(qemu_docdir, "sphinx")) |
Peter Maydell | 4078ee5 | 2020-09-25 17:23:02 +0100 | [diff] [blame] | 49 | sys.path.insert(0, os.path.join(qemu_docdir, "../scripts")) |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 50 | |
| 51 | |
| 52 | # -- General configuration ------------------------------------------------ |
| 53 | |
| 54 | # If your documentation needs a minimal Sphinx version, state it here. |
| 55 | # |
John Snow | fe791b7 | 2024-07-03 13:52:34 -0400 | [diff] [blame] | 56 | # 3.4.3 is the oldest version of Sphinx that ships on a platform we |
| 57 | # pledge build support for. |
| 58 | needs_sphinx = '3.4.3' |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 59 | |
| 60 | # Add any Sphinx extension module names here, as strings. They can be |
| 61 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
| 62 | # ones. |
John Snow | ecf92e3 | 2025-03-10 23:42:01 -0400 | [diff] [blame] | 63 | extensions = [ |
| 64 | 'depfile', |
| 65 | 'hxtool', |
| 66 | 'kerneldoc', |
| 67 | 'qapi_domain', |
| 68 | 'qapidoc', |
| 69 | 'qmp_lexer', |
| 70 | ] |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 71 | |
Marc-André Lureau | 2668dc7 | 2021-10-06 01:00:35 +0400 | [diff] [blame] | 72 | if sphinx.version_info[:3] > (4, 0, 0): |
| 73 | tags.add('sphinx4') |
| 74 | extensions += ['dbusdoc'] |
| 75 | else: |
| 76 | extensions += ['fakedbusdoc'] |
| 77 | |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 78 | # Add any paths that contain templates here, relative to this directory. |
Marc-André Lureau | 0dd35c1 | 2021-10-09 01:57:51 +0400 | [diff] [blame] | 79 | templates_path = [os.path.join(qemu_docdir, '_templates')] |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 80 | |
| 81 | # The suffix(es) of source filenames. |
| 82 | # You can specify multiple suffix as a list of string: |
| 83 | # |
| 84 | # source_suffix = ['.rst', '.md'] |
| 85 | source_suffix = '.rst' |
| 86 | |
| 87 | # The master toctree document. |
| 88 | master_doc = 'index' |
| 89 | |
John Snow | c11b3a1 | 2021-10-04 17:52:38 -0400 | [diff] [blame] | 90 | # Interpret `single-backticks` to be a cross-reference to any kind of |
| 91 | # referenceable object. Unresolvable or ambiguous references will emit a |
| 92 | # warning at build time. |
| 93 | default_role = 'any' |
| 94 | |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 95 | # General information about the project. |
| 96 | project = u'QEMU' |
Ani Sinha | 3d5d015 | 2025-01-01 13:31:16 +0530 | [diff] [blame] | 97 | copyright = u'2025, The QEMU Project Developers' |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 98 | author = u'The QEMU Project Developers' |
| 99 | |
| 100 | # The version info for the project you're documenting, acts as replacement for |
| 101 | # |version| and |release|, also used in various other places throughout the |
| 102 | # built documents. |
Peter Maydell | 6038f5f | 2019-03-07 14:26:47 +0000 | [diff] [blame] | 103 | |
| 104 | # Extract this information from the VERSION file, for the benefit of |
| 105 | # standalone Sphinx runs as used by readthedocs.org. Builds run from |
| 106 | # the Makefile will pass version and release on the sphinx-build |
| 107 | # command line, which override this. |
| 108 | try: |
| 109 | extracted_version = None |
| 110 | with open(os.path.join(qemu_docdir, '../VERSION')) as f: |
| 111 | extracted_version = f.readline().strip() |
| 112 | except: |
| 113 | pass |
| 114 | finally: |
| 115 | if extracted_version: |
| 116 | version = release = extracted_version |
| 117 | else: |
| 118 | version = release = "unknown version" |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 119 | |
Daniel P. Berrangé | ae8ac80 | 2025-02-25 19:39:12 +0000 | [diff] [blame] | 120 | bits = version.split(".") |
| 121 | |
| 122 | major = int(bits[0]) |
| 123 | minor = int(bits[1]) |
| 124 | micro = int(bits[2]) |
| 125 | |
| 126 | # Check for a dev snapshot, so we can adjust to next |
| 127 | # predicted release version. |
| 128 | # |
| 129 | # This assumes we do 3 releases per year, so must bump |
| 130 | # major if minor == 2 |
| 131 | if micro >= 50: |
| 132 | micro = 0 |
| 133 | if minor == 2: |
| 134 | major += 1 |
| 135 | minor = 0 |
| 136 | else: |
| 137 | minor += 1 |
| 138 | |
Daniel P. Berrangé | 3fbb0a1 | 2025-02-25 19:41:16 +0000 | [diff] [blame] | 139 | # These thresholds must match the constants |
| 140 | # MACHINE_VER_DELETION_MAJOR & MACHINE_VER_DEPRECATION_MAJOR |
| 141 | # defined in include/hw/boards.h and the introductory text in |
| 142 | # docs/about/deprecated.rst |
Daniel P. Berrangé | ae8ac80 | 2025-02-25 19:39:12 +0000 | [diff] [blame] | 143 | ver_machine_deprecation_version = "%d.%d.0" % (major - 3, minor) |
Daniel P. Berrangé | 83e256c | 2025-02-25 19:39:12 +0000 | [diff] [blame] | 144 | ver_machine_deletion_version = "%d.%d.0" % (major - 6, minor) |
Daniel P. Berrangé | ae8ac80 | 2025-02-25 19:39:12 +0000 | [diff] [blame] | 145 | |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 146 | # The language for content autogenerated by Sphinx. Refer to documentation |
| 147 | # for a list of supported languages. |
| 148 | # |
| 149 | # This is also used if you do content translation via gettext catalogs. |
| 150 | # Usually you set "language" from the command line for these cases. |
Martin Liška | ba1a672 | 2022-06-24 15:42:55 +0100 | [diff] [blame] | 151 | language = 'en' |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 152 | |
| 153 | # List of patterns, relative to source directory, that match files and |
| 154 | # directories to ignore when looking for source files. |
| 155 | # This patterns also effect to html_static_path and html_extra_path |
| 156 | exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] |
| 157 | |
| 158 | # The name of the Pygments (syntax highlighting) style to use. |
| 159 | pygments_style = 'sphinx' |
| 160 | |
| 161 | # If true, `todo` and `todoList` produce output, else they produce nothing. |
| 162 | todo_include_todos = False |
| 163 | |
Peter Maydell | e250e86 | 2019-03-07 14:26:46 +0000 | [diff] [blame] | 164 | # Sphinx defaults to warning about use of :option: for options not defined |
| 165 | # with "option::" in the document being processed. Turn that off. |
| 166 | suppress_warnings = ["ref.option"] |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 167 | |
Peter Maydell | 27a296f | 2019-09-05 14:10:40 +0100 | [diff] [blame] | 168 | # The rst_epilog fragment is effectively included in every rST file. |
| 169 | # We use it to define substitutions based on build config that |
| 170 | # can then be used in the documentation. The fallback if the |
| 171 | # environment variable is not set is for the benefit of readthedocs |
| 172 | # style document building; our Makefile always sets the variable. |
| 173 | confdir = os.getenv('CONFDIR', "/etc/qemu") |
Daniel P. Berrangé | ae8ac80 | 2025-02-25 19:39:12 +0000 | [diff] [blame] | 174 | |
| 175 | vars = { |
| 176 | "CONFDIR": confdir, |
| 177 | "VER_MACHINE_DEPRECATION_VERSION": ver_machine_deprecation_version, |
Daniel P. Berrangé | 83e256c | 2025-02-25 19:39:12 +0000 | [diff] [blame] | 178 | "VER_MACHINE_DELETION_VERSION": ver_machine_deletion_version, |
Daniel P. Berrangé | ae8ac80 | 2025-02-25 19:39:12 +0000 | [diff] [blame] | 179 | } |
| 180 | |
| 181 | rst_epilog = "".join([ |
| 182 | ".. |" + key + "| replace:: ``" + vars[key] + "``\n" |
| 183 | for key in vars.keys() |
| 184 | ]) |
| 185 | |
Peter Maydell | de1572c | 2020-02-28 15:36:00 +0000 | [diff] [blame] | 186 | # We slurp in the defs.rst.inc and literally include it into rst_epilog, |
| 187 | # because Sphinx's include:: directive doesn't work with absolute paths |
| 188 | # and there isn't any one single relative path that will work for all |
| 189 | # documents and for both via-make and direct sphinx-build invocation. |
| 190 | with open(os.path.join(qemu_docdir, 'defs.rst.inc')) as f: |
| 191 | rst_epilog += f.read() |
Peter Maydell | 27a296f | 2019-09-05 14:10:40 +0100 | [diff] [blame] | 192 | |
John Snow | ef137a2 | 2025-03-10 23:42:24 -0400 | [diff] [blame] | 193 | |
| 194 | # Normally, the QAPI domain is picky about what field lists you use to |
| 195 | # describe a QAPI entity. If you'd like to use arbitrary additional |
| 196 | # fields in source documentation, add them here. |
| 197 | qapi_allowed_fields = { |
| 198 | "see also", |
| 199 | } |
| 200 | |
John Snow | 25d44f5 | 2025-03-13 00:43:09 -0400 | [diff] [blame] | 201 | # Due to a limitation in Sphinx, we need to know which indices to |
| 202 | # generate in advance. Adding a namespace here allows that generation. |
John Snow | 602c90b | 2025-03-13 00:43:10 -0400 | [diff] [blame] | 203 | qapi_namespaces = { |
John Snow | a6af544 | 2025-03-13 00:43:12 -0400 | [diff] [blame] | 204 | "QGA", |
John Snow | 602c90b | 2025-03-13 00:43:10 -0400 | [diff] [blame] | 205 | "QMP", |
John Snow | a6af544 | 2025-03-13 00:43:12 -0400 | [diff] [blame] | 206 | "QSD", |
John Snow | 602c90b | 2025-03-13 00:43:10 -0400 | [diff] [blame] | 207 | } |
John Snow | ef137a2 | 2025-03-10 23:42:24 -0400 | [diff] [blame] | 208 | |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 209 | # -- Options for HTML output ---------------------------------------------- |
| 210 | |
| 211 | # The theme to use for HTML and HTML Help pages. See the documentation for |
| 212 | # a list of builtin themes. |
| 213 | # |
Marc-André Lureau | 73e6aec | 2021-03-23 15:53:28 +0400 | [diff] [blame] | 214 | try: |
| 215 | import sphinx_rtd_theme |
| 216 | except ImportError: |
| 217 | raise ConfigError( |
| 218 | 'The Sphinx \'sphinx_rtd_theme\' HTML theme was not found.\n' |
| 219 | ) |
| 220 | |
| 221 | html_theme = 'sphinx_rtd_theme' |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 222 | |
| 223 | # Theme options are theme-specific and customize the look and feel of a theme |
| 224 | # further. For a list of options available for each theme, see the |
| 225 | # documentation. |
Thomas Huth | eb84433 | 2024-03-04 14:04:03 +0100 | [diff] [blame] | 226 | html_theme_options = { |
| 227 | "style_nav_header_background": "#802400", |
| 228 | "navigation_with_keys": True, |
| 229 | } |
Marc-André Lureau | 73e6aec | 2021-03-23 15:53:28 +0400 | [diff] [blame] | 230 | |
| 231 | html_logo = os.path.join(qemu_docdir, "../ui/icons/qemu_128x128.png") |
| 232 | |
| 233 | html_favicon = os.path.join(qemu_docdir, "../ui/icons/qemu_32x32.png") |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 234 | |
| 235 | # Add any paths that contain custom static files (such as style sheets) here, |
| 236 | # relative to this directory. They are copied after the builtin static files, |
| 237 | # so a file named "default.css" will overwrite the builtin "default.css". |
Marc-André Lureau | 73e6aec | 2021-03-23 15:53:28 +0400 | [diff] [blame] | 238 | html_static_path = [os.path.join(qemu_docdir, "sphinx-static")] |
| 239 | |
| 240 | html_css_files = [ |
| 241 | 'theme_overrides.css', |
| 242 | ] |
| 243 | |
Marc-André Lureau | 9423751 | 2021-10-09 01:47:56 +0400 | [diff] [blame] | 244 | html_js_files = [ |
| 245 | 'custom.js', |
| 246 | ] |
| 247 | |
Marc-André Lureau | 73e6aec | 2021-03-23 15:53:28 +0400 | [diff] [blame] | 248 | html_context = { |
Daniel P. Berrangé | b5335c3 | 2024-12-09 16:35:06 +0000 | [diff] [blame] | 249 | "source_url_prefix": "https://gitlab.com/qemu-project/qemu/-/blob/master/docs/", |
Marc-André Lureau | 73e6aec | 2021-03-23 15:53:28 +0400 | [diff] [blame] | 250 | "gitlab_user": "qemu-project", |
| 251 | "gitlab_repo": "qemu", |
| 252 | "gitlab_version": "master", |
| 253 | "conf_py_path": "/docs/", # Path in the checkout to the docs root |
| 254 | } |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 255 | |
| 256 | # Custom sidebar templates, must be a dictionary that maps document names |
| 257 | # to template names. |
Marc-André Lureau | 73e6aec | 2021-03-23 15:53:28 +0400 | [diff] [blame] | 258 | #html_sidebars = {} |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 259 | |
Peter Maydell | 479fb8a | 2019-03-07 14:26:46 +0000 | [diff] [blame] | 260 | # Don't copy the rST source files to the HTML output directory, |
| 261 | # and don't put links to the sources into the output HTML. |
| 262 | html_copy_source = False |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 263 | |
| 264 | # -- Options for HTMLHelp output ------------------------------------------ |
| 265 | |
| 266 | # Output file base name for HTML help builder. |
| 267 | htmlhelp_basename = 'QEMUdoc' |
| 268 | |
| 269 | |
| 270 | # -- Options for LaTeX output --------------------------------------------- |
| 271 | |
| 272 | latex_elements = { |
| 273 | # The paper size ('letterpaper' or 'a4paper'). |
| 274 | # |
| 275 | # 'papersize': 'letterpaper', |
| 276 | |
| 277 | # The font size ('10pt', '11pt' or '12pt'). |
| 278 | # |
| 279 | # 'pointsize': '10pt', |
| 280 | |
| 281 | # Additional stuff for the LaTeX preamble. |
| 282 | # |
| 283 | # 'preamble': '', |
| 284 | |
| 285 | # Latex figure (float) alignment |
| 286 | # |
| 287 | # 'figure_align': 'htbp', |
| 288 | } |
| 289 | |
| 290 | # Grouping the document tree into LaTeX files. List of tuples |
| 291 | # (source start file, target name, title, |
| 292 | # author, documentclass [howto, manual, or own class]). |
| 293 | latex_documents = [ |
| 294 | (master_doc, 'QEMU.tex', u'QEMU Documentation', |
| 295 | u'The QEMU Project Developers', 'manual'), |
| 296 | ] |
| 297 | |
| 298 | |
| 299 | # -- Options for manual page output --------------------------------------- |
Peter Maydell | 27a296f | 2019-09-05 14:10:40 +0100 | [diff] [blame] | 300 | # Individual manual/conf.py can override this to create man pages |
Peter Maydell | b93f4fb | 2021-01-15 15:44:49 +0000 | [diff] [blame] | 301 | man_pages = [ |
| 302 | ('interop/qemu-ga', 'qemu-ga', |
| 303 | 'QEMU Guest Agent', |
| 304 | ['Michael Roth <mdroth@linux.vnet.ibm.com>'], 8), |
| 305 | ('interop/qemu-ga-ref', 'qemu-ga-ref', |
| 306 | 'QEMU Guest Agent Protocol Reference', |
| 307 | [], 7), |
| 308 | ('interop/qemu-qmp-ref', 'qemu-qmp-ref', |
| 309 | 'QEMU QMP Reference Manual', |
| 310 | [], 7), |
| 311 | ('interop/qemu-storage-daemon-qmp-ref', 'qemu-storage-daemon-qmp-ref', |
| 312 | 'QEMU Storage Daemon QMP Reference Manual', |
| 313 | [], 7), |
| 314 | ('system/qemu-manpage', 'qemu', |
| 315 | 'QEMU User Documentation', |
| 316 | ['Fabrice Bellard'], 1), |
| 317 | ('system/qemu-block-drivers', 'qemu-block-drivers', |
| 318 | 'QEMU block drivers reference', |
| 319 | ['Fabrice Bellard and the QEMU Project developers'], 7), |
| 320 | ('system/qemu-cpu-models', 'qemu-cpu-models', |
| 321 | 'QEMU CPU Models', |
| 322 | ['The QEMU Project developers'], 7), |
| 323 | ('tools/qemu-img', 'qemu-img', |
| 324 | 'QEMU disk image utility', |
| 325 | ['Fabrice Bellard'], 1), |
| 326 | ('tools/qemu-nbd', 'qemu-nbd', |
| 327 | 'QEMU Disk Network Block Device Server', |
| 328 | ['Anthony Liguori <anthony@codemonkey.ws>'], 8), |
| 329 | ('tools/qemu-pr-helper', 'qemu-pr-helper', |
| 330 | 'QEMU persistent reservation helper', |
| 331 | [], 8), |
| 332 | ('tools/qemu-storage-daemon', 'qemu-storage-daemon', |
| 333 | 'QEMU storage daemon', |
| 334 | [], 1), |
| 335 | ('tools/qemu-trace-stap', 'qemu-trace-stap', |
| 336 | 'QEMU SystemTap trace tool', |
| 337 | [], 1), |
Peter Maydell | b93f4fb | 2021-01-15 15:44:49 +0000 | [diff] [blame] | 338 | ] |
Damien Goutte-Gattat | 269a7e9 | 2021-05-03 17:14:22 +0100 | [diff] [blame] | 339 | man_make_section_directory = False |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 340 | |
Peter Maydell | 22b5ea7 | 2019-11-29 14:16:12 +0100 | [diff] [blame] | 341 | # We use paths starting from qemu_docdir here so that you can run |
| 342 | # sphinx-build from anywhere and the kerneldoc extension can still |
| 343 | # find everything. |
Yonggang Luo | a94a689 | 2020-10-16 06:06:23 +0800 | [diff] [blame] | 344 | kerneldoc_bin = ['perl', os.path.join(qemu_docdir, '../scripts/kernel-doc')] |
Peter Maydell | 22b5ea7 | 2019-11-29 14:16:12 +0100 | [diff] [blame] | 345 | kerneldoc_srctree = os.path.join(qemu_docdir, '..') |
Peter Maydell | 6803d6e | 2020-01-24 16:26:01 +0000 | [diff] [blame] | 346 | hxtool_srctree = os.path.join(qemu_docdir, '..') |
Peter Maydell | 4078ee5 | 2020-09-25 17:23:02 +0100 | [diff] [blame] | 347 | qapidoc_srctree = os.path.join(qemu_docdir, '..') |
Marc-André Lureau | 2668dc7 | 2021-10-06 01:00:35 +0400 | [diff] [blame] | 348 | dbusdoc_srctree = os.path.join(qemu_docdir, '..') |
| 349 | dbus_index_common_prefix = ["org.qemu."] |