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