blob: 60dcf2a54179b70042466db517699b0377640414 [file] [log] [blame]
Peter Maydell5329da62019-03-07 14:26:45 +00001# -*- 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 Maydellf8cf7142019-03-07 14:26:46 +00006# 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 Maydell5329da62019-03-07 14:26:45 +000020# 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 Maydellf8cf7142019-03-07 14:26:46 +000029import os
30import sys
Peter Maydell758b6172020-02-13 17:56:19 +000031import sphinx
Peter Maydelle22684e2020-03-30 13:18:59 +010032from sphinx.errors import ConfigError
Peter Maydell758b6172020-02-13 17:56:19 +000033
Peter Maydellf8cf7142019-03-07 14:26:46 +000034# 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.
37try:
38 qemu_docdir
39except NameError:
40 qemu_docdir = os.path.abspath(".")
41
Peter Maydell5329da62019-03-07 14:26:45 +000042# 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 Maydellf8cf7142019-03-07 14:26:46 +000044# documentation root, use an absolute path starting from qemu_docdir.
Peter Maydell5329da62019-03-07 14:26:45 +000045#
Peter Maydell4078ee52020-09-25 17:23:02 +010046# Our extensions are in docs/sphinx; the qapidoc extension requires
47# the QAPI modules from scripts/.
John Snowcd231e12019-07-10 15:08:06 -040048sys.path.insert(0, os.path.join(qemu_docdir, "sphinx"))
Peter Maydell4078ee52020-09-25 17:23:02 +010049sys.path.insert(0, os.path.join(qemu_docdir, "../scripts"))
Peter Maydell5329da62019-03-07 14:26:45 +000050
51
52# -- General configuration ------------------------------------------------
53
54# If your documentation needs a minimal Sphinx version, state it here.
55#
John Snowfe791b72024-07-03 13:52:34 -040056# 3.4.3 is the oldest version of Sphinx that ships on a platform we
57# pledge build support for.
58needs_sphinx = '3.4.3'
Peter Maydell5329da62019-03-07 14:26:45 +000059
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 Snowecf92e32025-03-10 23:42:01 -040063extensions = [
64 'depfile',
65 'hxtool',
66 'kerneldoc',
67 'qapi_domain',
68 'qapidoc',
69 'qmp_lexer',
70]
Peter Maydell5329da62019-03-07 14:26:45 +000071
Marc-André Lureau2668dc72021-10-06 01:00:35 +040072if sphinx.version_info[:3] > (4, 0, 0):
73 tags.add('sphinx4')
74 extensions += ['dbusdoc']
75else:
76 extensions += ['fakedbusdoc']
77
Peter Maydell5329da62019-03-07 14:26:45 +000078# Add any paths that contain templates here, relative to this directory.
Marc-André Lureau0dd35c12021-10-09 01:57:51 +040079templates_path = [os.path.join(qemu_docdir, '_templates')]
Peter Maydell5329da62019-03-07 14:26:45 +000080
81# The suffix(es) of source filenames.
82# You can specify multiple suffix as a list of string:
83#
84# source_suffix = ['.rst', '.md']
85source_suffix = '.rst'
86
87# The master toctree document.
88master_doc = 'index'
89
John Snowc11b3a12021-10-04 17:52:38 -040090# 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.
93default_role = 'any'
94
Peter Maydell5329da62019-03-07 14:26:45 +000095# General information about the project.
96project = u'QEMU'
Ani Sinha3d5d0152025-01-01 13:31:16 +053097copyright = u'2025, The QEMU Project Developers'
Peter Maydell5329da62019-03-07 14:26:45 +000098author = 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 Maydell6038f5f2019-03-07 14:26:47 +0000103
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.
108try:
109 extracted_version = None
110 with open(os.path.join(qemu_docdir, '../VERSION')) as f:
111 extracted_version = f.readline().strip()
112except:
113 pass
114finally:
115 if extracted_version:
116 version = release = extracted_version
117 else:
118 version = release = "unknown version"
Peter Maydell5329da62019-03-07 14:26:45 +0000119
Daniel P. Berrangéae8ac802025-02-25 19:39:12 +0000120bits = version.split(".")
121
122major = int(bits[0])
123minor = int(bits[1])
124micro = 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
131if micro >= 50:
132 micro = 0
133 if minor == 2:
134 major += 1
135 minor = 0
136 else:
137 minor += 1
138
139ver_machine_deprecation_version = "%d.%d.0" % (major - 3, minor)
140
Peter Maydell5329da62019-03-07 14:26:45 +0000141# The language for content autogenerated by Sphinx. Refer to documentation
142# for a list of supported languages.
143#
144# This is also used if you do content translation via gettext catalogs.
145# Usually you set "language" from the command line for these cases.
Martin Liškaba1a6722022-06-24 15:42:55 +0100146language = 'en'
Peter Maydell5329da62019-03-07 14:26:45 +0000147
148# List of patterns, relative to source directory, that match files and
149# directories to ignore when looking for source files.
150# This patterns also effect to html_static_path and html_extra_path
151exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
152
153# The name of the Pygments (syntax highlighting) style to use.
154pygments_style = 'sphinx'
155
156# If true, `todo` and `todoList` produce output, else they produce nothing.
157todo_include_todos = False
158
Peter Maydelle250e862019-03-07 14:26:46 +0000159# Sphinx defaults to warning about use of :option: for options not defined
160# with "option::" in the document being processed. Turn that off.
161suppress_warnings = ["ref.option"]
Peter Maydell5329da62019-03-07 14:26:45 +0000162
Peter Maydell27a296f2019-09-05 14:10:40 +0100163# The rst_epilog fragment is effectively included in every rST file.
164# We use it to define substitutions based on build config that
165# can then be used in the documentation. The fallback if the
166# environment variable is not set is for the benefit of readthedocs
167# style document building; our Makefile always sets the variable.
168confdir = os.getenv('CONFDIR', "/etc/qemu")
Daniel P. Berrangéae8ac802025-02-25 19:39:12 +0000169
170vars = {
171 "CONFDIR": confdir,
172 "VER_MACHINE_DEPRECATION_VERSION": ver_machine_deprecation_version,
173}
174
175rst_epilog = "".join([
176 ".. |" + key + "| replace:: ``" + vars[key] + "``\n"
177 for key in vars.keys()
178])
179
Peter Maydellde1572c2020-02-28 15:36:00 +0000180# We slurp in the defs.rst.inc and literally include it into rst_epilog,
181# because Sphinx's include:: directive doesn't work with absolute paths
182# and there isn't any one single relative path that will work for all
183# documents and for both via-make and direct sphinx-build invocation.
184with open(os.path.join(qemu_docdir, 'defs.rst.inc')) as f:
185 rst_epilog += f.read()
Peter Maydell27a296f2019-09-05 14:10:40 +0100186
John Snowef137a22025-03-10 23:42:24 -0400187
188# Normally, the QAPI domain is picky about what field lists you use to
189# describe a QAPI entity. If you'd like to use arbitrary additional
190# fields in source documentation, add them here.
191qapi_allowed_fields = {
192 "see also",
193}
194
John Snow25d44f52025-03-13 00:43:09 -0400195# Due to a limitation in Sphinx, we need to know which indices to
196# generate in advance. Adding a namespace here allows that generation.
John Snow602c90b2025-03-13 00:43:10 -0400197qapi_namespaces = {
John Snowa6af5442025-03-13 00:43:12 -0400198 "QGA",
John Snow602c90b2025-03-13 00:43:10 -0400199 "QMP",
John Snowa6af5442025-03-13 00:43:12 -0400200 "QSD",
John Snow602c90b2025-03-13 00:43:10 -0400201}
John Snowef137a22025-03-10 23:42:24 -0400202
Peter Maydell5329da62019-03-07 14:26:45 +0000203# -- Options for HTML output ----------------------------------------------
204
205# The theme to use for HTML and HTML Help pages. See the documentation for
206# a list of builtin themes.
207#
Marc-André Lureau73e6aec2021-03-23 15:53:28 +0400208try:
209 import sphinx_rtd_theme
210except ImportError:
211 raise ConfigError(
212 'The Sphinx \'sphinx_rtd_theme\' HTML theme was not found.\n'
213 )
214
215html_theme = 'sphinx_rtd_theme'
Peter Maydell5329da62019-03-07 14:26:45 +0000216
217# Theme options are theme-specific and customize the look and feel of a theme
218# further. For a list of options available for each theme, see the
219# documentation.
Thomas Hutheb844332024-03-04 14:04:03 +0100220html_theme_options = {
221 "style_nav_header_background": "#802400",
222 "navigation_with_keys": True,
223}
Marc-André Lureau73e6aec2021-03-23 15:53:28 +0400224
225html_logo = os.path.join(qemu_docdir, "../ui/icons/qemu_128x128.png")
226
227html_favicon = os.path.join(qemu_docdir, "../ui/icons/qemu_32x32.png")
Peter Maydell5329da62019-03-07 14:26:45 +0000228
229# Add any paths that contain custom static files (such as style sheets) here,
230# relative to this directory. They are copied after the builtin static files,
231# so a file named "default.css" will overwrite the builtin "default.css".
Marc-André Lureau73e6aec2021-03-23 15:53:28 +0400232html_static_path = [os.path.join(qemu_docdir, "sphinx-static")]
233
234html_css_files = [
235 'theme_overrides.css',
236]
237
Marc-André Lureau94237512021-10-09 01:47:56 +0400238html_js_files = [
239 'custom.js',
240]
241
Marc-André Lureau73e6aec2021-03-23 15:53:28 +0400242html_context = {
Daniel P. Berrangéb5335c32024-12-09 16:35:06 +0000243 "source_url_prefix": "https://gitlab.com/qemu-project/qemu/-/blob/master/docs/",
Marc-André Lureau73e6aec2021-03-23 15:53:28 +0400244 "gitlab_user": "qemu-project",
245 "gitlab_repo": "qemu",
246 "gitlab_version": "master",
247 "conf_py_path": "/docs/", # Path in the checkout to the docs root
248}
Peter Maydell5329da62019-03-07 14:26:45 +0000249
250# Custom sidebar templates, must be a dictionary that maps document names
251# to template names.
Marc-André Lureau73e6aec2021-03-23 15:53:28 +0400252#html_sidebars = {}
Peter Maydell5329da62019-03-07 14:26:45 +0000253
Peter Maydell479fb8a2019-03-07 14:26:46 +0000254# Don't copy the rST source files to the HTML output directory,
255# and don't put links to the sources into the output HTML.
256html_copy_source = False
Peter Maydell5329da62019-03-07 14:26:45 +0000257
258# -- Options for HTMLHelp output ------------------------------------------
259
260# Output file base name for HTML help builder.
261htmlhelp_basename = 'QEMUdoc'
262
263
264# -- Options for LaTeX output ---------------------------------------------
265
266latex_elements = {
267 # The paper size ('letterpaper' or 'a4paper').
268 #
269 # 'papersize': 'letterpaper',
270
271 # The font size ('10pt', '11pt' or '12pt').
272 #
273 # 'pointsize': '10pt',
274
275 # Additional stuff for the LaTeX preamble.
276 #
277 # 'preamble': '',
278
279 # Latex figure (float) alignment
280 #
281 # 'figure_align': 'htbp',
282}
283
284# Grouping the document tree into LaTeX files. List of tuples
285# (source start file, target name, title,
286# author, documentclass [howto, manual, or own class]).
287latex_documents = [
288 (master_doc, 'QEMU.tex', u'QEMU Documentation',
289 u'The QEMU Project Developers', 'manual'),
290]
291
292
293# -- Options for manual page output ---------------------------------------
Peter Maydell27a296f2019-09-05 14:10:40 +0100294# Individual manual/conf.py can override this to create man pages
Peter Maydellb93f4fb2021-01-15 15:44:49 +0000295man_pages = [
296 ('interop/qemu-ga', 'qemu-ga',
297 'QEMU Guest Agent',
298 ['Michael Roth <mdroth@linux.vnet.ibm.com>'], 8),
299 ('interop/qemu-ga-ref', 'qemu-ga-ref',
300 'QEMU Guest Agent Protocol Reference',
301 [], 7),
302 ('interop/qemu-qmp-ref', 'qemu-qmp-ref',
303 'QEMU QMP Reference Manual',
304 [], 7),
305 ('interop/qemu-storage-daemon-qmp-ref', 'qemu-storage-daemon-qmp-ref',
306 'QEMU Storage Daemon QMP Reference Manual',
307 [], 7),
308 ('system/qemu-manpage', 'qemu',
309 'QEMU User Documentation',
310 ['Fabrice Bellard'], 1),
311 ('system/qemu-block-drivers', 'qemu-block-drivers',
312 'QEMU block drivers reference',
313 ['Fabrice Bellard and the QEMU Project developers'], 7),
314 ('system/qemu-cpu-models', 'qemu-cpu-models',
315 'QEMU CPU Models',
316 ['The QEMU Project developers'], 7),
317 ('tools/qemu-img', 'qemu-img',
318 'QEMU disk image utility',
319 ['Fabrice Bellard'], 1),
320 ('tools/qemu-nbd', 'qemu-nbd',
321 'QEMU Disk Network Block Device Server',
322 ['Anthony Liguori <anthony@codemonkey.ws>'], 8),
323 ('tools/qemu-pr-helper', 'qemu-pr-helper',
324 'QEMU persistent reservation helper',
325 [], 8),
326 ('tools/qemu-storage-daemon', 'qemu-storage-daemon',
327 'QEMU storage daemon',
328 [], 1),
329 ('tools/qemu-trace-stap', 'qemu-trace-stap',
330 'QEMU SystemTap trace tool',
331 [], 1),
Peter Maydellb93f4fb2021-01-15 15:44:49 +0000332]
Damien Goutte-Gattat269a7e92021-05-03 17:14:22 +0100333man_make_section_directory = False
Peter Maydell5329da62019-03-07 14:26:45 +0000334
Peter Maydell22b5ea72019-11-29 14:16:12 +0100335# We use paths starting from qemu_docdir here so that you can run
336# sphinx-build from anywhere and the kerneldoc extension can still
337# find everything.
Yonggang Luoa94a6892020-10-16 06:06:23 +0800338kerneldoc_bin = ['perl', os.path.join(qemu_docdir, '../scripts/kernel-doc')]
Peter Maydell22b5ea72019-11-29 14:16:12 +0100339kerneldoc_srctree = os.path.join(qemu_docdir, '..')
Peter Maydell6803d6e2020-01-24 16:26:01 +0000340hxtool_srctree = os.path.join(qemu_docdir, '..')
Peter Maydell4078ee52020-09-25 17:23:02 +0100341qapidoc_srctree = os.path.join(qemu_docdir, '..')
Marc-André Lureau2668dc72021-10-06 01:00:35 +0400342dbusdoc_srctree = os.path.join(qemu_docdir, '..')
343dbus_index_common_prefix = ["org.qemu."]