blob: e84a95e71ce1e79c2d0596d0dbe3485c7debbea6 [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
Marc-André Lureau73e6aec2021-03-23 15:53:28 +040032from distutils.version import LooseVersion
Peter Maydelle22684e2020-03-30 13:18:59 +010033from sphinx.errors import ConfigError
Peter Maydell758b6172020-02-13 17:56:19 +000034
Peter Maydellf8cf7142019-03-07 14:26:46 +000035# The per-manual conf.py will set qemu_docdir for a single-manual build;
36# otherwise set it here if this is an entire-manual-set build.
37# This is always the absolute path of the docs/ directory in the source tree.
38try:
39 qemu_docdir
40except NameError:
41 qemu_docdir = os.path.abspath(".")
42
Peter Maydell5329da62019-03-07 14:26:45 +000043# If extensions (or modules to document with autodoc) are in another directory,
44# add these directories to sys.path here. If the directory is relative to the
Peter Maydellf8cf7142019-03-07 14:26:46 +000045# documentation root, use an absolute path starting from qemu_docdir.
Peter Maydell5329da62019-03-07 14:26:45 +000046#
Peter Maydell4078ee52020-09-25 17:23:02 +010047# Our extensions are in docs/sphinx; the qapidoc extension requires
48# the QAPI modules from scripts/.
John Snowcd231e12019-07-10 15:08:06 -040049sys.path.insert(0, os.path.join(qemu_docdir, "sphinx"))
Peter Maydell4078ee52020-09-25 17:23:02 +010050sys.path.insert(0, os.path.join(qemu_docdir, "../scripts"))
Peter Maydell5329da62019-03-07 14:26:45 +000051
52
53# -- General configuration ------------------------------------------------
54
55# If your documentation needs a minimal Sphinx version, state it here.
56#
Peter Maydellbf3f8572020-04-14 13:41:14 +010057# Sphinx 1.5 and earlier can't build our docs because they are too
58# picky about the syntax of the argument to the option:: directive
59# (see Sphinx bugs #646, #3366).
60needs_sphinx = '1.6'
Peter Maydell5329da62019-03-07 14:26:45 +000061
62# Add any Sphinx extension module names here, as strings. They can be
63# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
64# ones.
Peter Maydell4078ee52020-09-25 17:23:02 +010065extensions = ['kerneldoc', 'qmp_lexer', 'hxtool', 'depfile', 'qapidoc']
Peter Maydell5329da62019-03-07 14:26:45 +000066
Marc-André Lureau2668dc72021-10-06 01:00:35 +040067if sphinx.version_info[:3] > (4, 0, 0):
68 tags.add('sphinx4')
69 extensions += ['dbusdoc']
70else:
71 extensions += ['fakedbusdoc']
72
Peter Maydell5329da62019-03-07 14:26:45 +000073# Add any paths that contain templates here, relative to this directory.
Marc-André Lureau0dd35c12021-10-09 01:57:51 +040074templates_path = [os.path.join(qemu_docdir, '_templates')]
Peter Maydell5329da62019-03-07 14:26:45 +000075
76# The suffix(es) of source filenames.
77# You can specify multiple suffix as a list of string:
78#
79# source_suffix = ['.rst', '.md']
80source_suffix = '.rst'
81
82# The master toctree document.
83master_doc = 'index'
84
John Snowc11b3a12021-10-04 17:52:38 -040085# Interpret `single-backticks` to be a cross-reference to any kind of
86# referenceable object. Unresolvable or ambiguous references will emit a
87# warning at build time.
88default_role = 'any'
89
Peter Maydell5329da62019-03-07 14:26:45 +000090# General information about the project.
91project = u'QEMU'
Enze Li5d6c6872023-05-25 14:43:45 +080092copyright = u'2023, The QEMU Project Developers'
Peter Maydell5329da62019-03-07 14:26:45 +000093author = u'The QEMU Project Developers'
94
95# The version info for the project you're documenting, acts as replacement for
96# |version| and |release|, also used in various other places throughout the
97# built documents.
Peter Maydell6038f5f2019-03-07 14:26:47 +000098
99# Extract this information from the VERSION file, for the benefit of
100# standalone Sphinx runs as used by readthedocs.org. Builds run from
101# the Makefile will pass version and release on the sphinx-build
102# command line, which override this.
103try:
104 extracted_version = None
105 with open(os.path.join(qemu_docdir, '../VERSION')) as f:
106 extracted_version = f.readline().strip()
107except:
108 pass
109finally:
110 if extracted_version:
111 version = release = extracted_version
112 else:
113 version = release = "unknown version"
Peter Maydell5329da62019-03-07 14:26:45 +0000114
115# The language for content autogenerated by Sphinx. Refer to documentation
116# for a list of supported languages.
117#
118# This is also used if you do content translation via gettext catalogs.
119# Usually you set "language" from the command line for these cases.
Martin Liškaba1a6722022-06-24 15:42:55 +0100120language = 'en'
Peter Maydell5329da62019-03-07 14:26:45 +0000121
122# List of patterns, relative to source directory, that match files and
123# directories to ignore when looking for source files.
124# This patterns also effect to html_static_path and html_extra_path
125exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
126
127# The name of the Pygments (syntax highlighting) style to use.
128pygments_style = 'sphinx'
129
130# If true, `todo` and `todoList` produce output, else they produce nothing.
131todo_include_todos = False
132
Peter Maydelle250e862019-03-07 14:26:46 +0000133# Sphinx defaults to warning about use of :option: for options not defined
134# with "option::" in the document being processed. Turn that off.
135suppress_warnings = ["ref.option"]
Peter Maydell5329da62019-03-07 14:26:45 +0000136
Peter Maydell27a296f2019-09-05 14:10:40 +0100137# The rst_epilog fragment is effectively included in every rST file.
138# We use it to define substitutions based on build config that
139# can then be used in the documentation. The fallback if the
140# environment variable is not set is for the benefit of readthedocs
141# style document building; our Makefile always sets the variable.
142confdir = os.getenv('CONFDIR', "/etc/qemu")
143rst_epilog = ".. |CONFDIR| replace:: ``" + confdir + "``\n"
Peter Maydellde1572c2020-02-28 15:36:00 +0000144# We slurp in the defs.rst.inc and literally include it into rst_epilog,
145# because Sphinx's include:: directive doesn't work with absolute paths
146# and there isn't any one single relative path that will work for all
147# documents and for both via-make and direct sphinx-build invocation.
148with open(os.path.join(qemu_docdir, 'defs.rst.inc')) as f:
149 rst_epilog += f.read()
Peter Maydell27a296f2019-09-05 14:10:40 +0100150
Peter Maydell5329da62019-03-07 14:26:45 +0000151# -- Options for HTML output ----------------------------------------------
152
153# The theme to use for HTML and HTML Help pages. See the documentation for
154# a list of builtin themes.
155#
Marc-André Lureau73e6aec2021-03-23 15:53:28 +0400156try:
157 import sphinx_rtd_theme
158except ImportError:
159 raise ConfigError(
160 'The Sphinx \'sphinx_rtd_theme\' HTML theme was not found.\n'
161 )
162
163html_theme = 'sphinx_rtd_theme'
Peter Maydell5329da62019-03-07 14:26:45 +0000164
165# Theme options are theme-specific and customize the look and feel of a theme
166# further. For a list of options available for each theme, see the
167# documentation.
Marc-André Lureau73e6aec2021-03-23 15:53:28 +0400168if LooseVersion(sphinx_rtd_theme.__version__) >= LooseVersion("0.4.3"):
169 html_theme_options = {
170 "style_nav_header_background": "#802400",
Marc-André Lureau96871b32021-10-09 01:06:38 +0400171 "navigation_with_keys": True,
Marc-André Lureau73e6aec2021-03-23 15:53:28 +0400172 }
173
174html_logo = os.path.join(qemu_docdir, "../ui/icons/qemu_128x128.png")
175
176html_favicon = os.path.join(qemu_docdir, "../ui/icons/qemu_32x32.png")
Peter Maydell5329da62019-03-07 14:26:45 +0000177
178# Add any paths that contain custom static files (such as style sheets) here,
179# relative to this directory. They are copied after the builtin static files,
180# so a file named "default.css" will overwrite the builtin "default.css".
Marc-André Lureau73e6aec2021-03-23 15:53:28 +0400181html_static_path = [os.path.join(qemu_docdir, "sphinx-static")]
182
183html_css_files = [
184 'theme_overrides.css',
185]
186
Marc-André Lureau94237512021-10-09 01:47:56 +0400187html_js_files = [
188 'custom.js',
189]
190
Marc-André Lureau73e6aec2021-03-23 15:53:28 +0400191html_context = {
192 "display_gitlab": True,
193 "gitlab_user": "qemu-project",
194 "gitlab_repo": "qemu",
195 "gitlab_version": "master",
196 "conf_py_path": "/docs/", # Path in the checkout to the docs root
197}
Peter Maydell5329da62019-03-07 14:26:45 +0000198
199# Custom sidebar templates, must be a dictionary that maps document names
200# to template names.
Marc-André Lureau73e6aec2021-03-23 15:53:28 +0400201#html_sidebars = {}
Peter Maydell5329da62019-03-07 14:26:45 +0000202
Peter Maydell479fb8a2019-03-07 14:26:46 +0000203# Don't copy the rST source files to the HTML output directory,
204# and don't put links to the sources into the output HTML.
205html_copy_source = False
Peter Maydell5329da62019-03-07 14:26:45 +0000206
207# -- Options for HTMLHelp output ------------------------------------------
208
209# Output file base name for HTML help builder.
210htmlhelp_basename = 'QEMUdoc'
211
212
213# -- Options for LaTeX output ---------------------------------------------
214
215latex_elements = {
216 # The paper size ('letterpaper' or 'a4paper').
217 #
218 # 'papersize': 'letterpaper',
219
220 # The font size ('10pt', '11pt' or '12pt').
221 #
222 # 'pointsize': '10pt',
223
224 # Additional stuff for the LaTeX preamble.
225 #
226 # 'preamble': '',
227
228 # Latex figure (float) alignment
229 #
230 # 'figure_align': 'htbp',
231}
232
233# Grouping the document tree into LaTeX files. List of tuples
234# (source start file, target name, title,
235# author, documentclass [howto, manual, or own class]).
236latex_documents = [
237 (master_doc, 'QEMU.tex', u'QEMU Documentation',
238 u'The QEMU Project Developers', 'manual'),
239]
240
241
242# -- Options for manual page output ---------------------------------------
Peter Maydell27a296f2019-09-05 14:10:40 +0100243# Individual manual/conf.py can override this to create man pages
Peter Maydellb93f4fb2021-01-15 15:44:49 +0000244man_pages = [
245 ('interop/qemu-ga', 'qemu-ga',
246 'QEMU Guest Agent',
247 ['Michael Roth <mdroth@linux.vnet.ibm.com>'], 8),
248 ('interop/qemu-ga-ref', 'qemu-ga-ref',
249 'QEMU Guest Agent Protocol Reference',
250 [], 7),
251 ('interop/qemu-qmp-ref', 'qemu-qmp-ref',
252 'QEMU QMP Reference Manual',
253 [], 7),
254 ('interop/qemu-storage-daemon-qmp-ref', 'qemu-storage-daemon-qmp-ref',
255 'QEMU Storage Daemon QMP Reference Manual',
256 [], 7),
257 ('system/qemu-manpage', 'qemu',
258 'QEMU User Documentation',
259 ['Fabrice Bellard'], 1),
260 ('system/qemu-block-drivers', 'qemu-block-drivers',
261 'QEMU block drivers reference',
262 ['Fabrice Bellard and the QEMU Project developers'], 7),
263 ('system/qemu-cpu-models', 'qemu-cpu-models',
264 'QEMU CPU Models',
265 ['The QEMU Project developers'], 7),
266 ('tools/qemu-img', 'qemu-img',
267 'QEMU disk image utility',
268 ['Fabrice Bellard'], 1),
269 ('tools/qemu-nbd', 'qemu-nbd',
270 'QEMU Disk Network Block Device Server',
271 ['Anthony Liguori <anthony@codemonkey.ws>'], 8),
272 ('tools/qemu-pr-helper', 'qemu-pr-helper',
273 'QEMU persistent reservation helper',
274 [], 8),
275 ('tools/qemu-storage-daemon', 'qemu-storage-daemon',
276 'QEMU storage daemon',
277 [], 1),
278 ('tools/qemu-trace-stap', 'qemu-trace-stap',
279 'QEMU SystemTap trace tool',
280 [], 1),
281 ('tools/virtfs-proxy-helper', 'virtfs-proxy-helper',
282 'QEMU 9p virtfs proxy filesystem helper',
283 ['M. Mohan Kumar'], 1),
Peter Maydellb93f4fb2021-01-15 15:44:49 +0000284]
Damien Goutte-Gattat269a7e92021-05-03 17:14:22 +0100285man_make_section_directory = False
Peter Maydell5329da62019-03-07 14:26:45 +0000286
Peter Maydell22b5ea72019-11-29 14:16:12 +0100287# We use paths starting from qemu_docdir here so that you can run
288# sphinx-build from anywhere and the kerneldoc extension can still
289# find everything.
Yonggang Luoa94a6892020-10-16 06:06:23 +0800290kerneldoc_bin = ['perl', os.path.join(qemu_docdir, '../scripts/kernel-doc')]
Peter Maydell22b5ea72019-11-29 14:16:12 +0100291kerneldoc_srctree = os.path.join(qemu_docdir, '..')
Peter Maydell6803d6e2020-01-24 16:26:01 +0000292hxtool_srctree = os.path.join(qemu_docdir, '..')
Peter Maydell4078ee52020-09-25 17:23:02 +0100293qapidoc_srctree = os.path.join(qemu_docdir, '..')
Marc-André Lureau2668dc72021-10-06 01:00:35 +0400294dbusdoc_srctree = os.path.join(qemu_docdir, '..')
295dbus_index_common_prefix = ["org.qemu."]