blob: d6e173ef77bfb47a4dc7ba3ed55b2074ce317977 [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
34# Make Sphinx fail cleanly if using an old Python, rather than obscurely
35# failing because some code in one of our extensions doesn't work there.
Peter Maydelle22684e2020-03-30 13:18:59 +010036# In newer versions of Sphinx this will display nicely; in older versions
37# Sphinx will also produce a Python backtrace but at least the information
38# gets printed...
Peter Maydell758b6172020-02-13 17:56:19 +000039if sys.version_info < (3,5):
Peter Maydelle22684e2020-03-30 13:18:59 +010040 raise ConfigError(
Peter Maydell758b6172020-02-13 17:56:19 +000041 "QEMU requires a Sphinx that uses Python 3.5 or better\n")
Peter Maydellf8cf7142019-03-07 14:26:46 +000042
43# The per-manual conf.py will set qemu_docdir for a single-manual build;
44# otherwise set it here if this is an entire-manual-set build.
45# This is always the absolute path of the docs/ directory in the source tree.
46try:
47 qemu_docdir
48except NameError:
49 qemu_docdir = os.path.abspath(".")
50
Peter Maydell5329da62019-03-07 14:26:45 +000051# If extensions (or modules to document with autodoc) are in another directory,
52# add these directories to sys.path here. If the directory is relative to the
Peter Maydellf8cf7142019-03-07 14:26:46 +000053# documentation root, use an absolute path starting from qemu_docdir.
Peter Maydell5329da62019-03-07 14:26:45 +000054#
John Snowcd231e12019-07-10 15:08:06 -040055sys.path.insert(0, os.path.join(qemu_docdir, "sphinx"))
Peter Maydell5329da62019-03-07 14:26:45 +000056
57
58# -- General configuration ------------------------------------------------
59
60# If your documentation needs a minimal Sphinx version, state it here.
61#
Peter Maydellbf3f8572020-04-14 13:41:14 +010062# Sphinx 1.5 and earlier can't build our docs because they are too
63# picky about the syntax of the argument to the option:: directive
64# (see Sphinx bugs #646, #3366).
65needs_sphinx = '1.6'
Peter Maydell5329da62019-03-07 14:26:45 +000066
67# Add any Sphinx extension module names here, as strings. They can be
68# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
69# ones.
Peter Maydell6803d6e2020-01-24 16:26:01 +000070extensions = ['kerneldoc', 'qmp_lexer', 'hxtool']
Peter Maydell5329da62019-03-07 14:26:45 +000071
72# Add any paths that contain templates here, relative to this directory.
73templates_path = ['_templates']
74
75# The suffix(es) of source filenames.
76# You can specify multiple suffix as a list of string:
77#
78# source_suffix = ['.rst', '.md']
79source_suffix = '.rst'
80
81# The master toctree document.
82master_doc = 'index'
83
84# General information about the project.
85project = u'QEMU'
Peter Maydell9b26a612020-03-16 11:20:06 +000086copyright = u'2020, The QEMU Project Developers'
Peter Maydell5329da62019-03-07 14:26:45 +000087author = u'The QEMU Project Developers'
88
89# The version info for the project you're documenting, acts as replacement for
90# |version| and |release|, also used in various other places throughout the
91# built documents.
Peter Maydell6038f5f2019-03-07 14:26:47 +000092
93# Extract this information from the VERSION file, for the benefit of
94# standalone Sphinx runs as used by readthedocs.org. Builds run from
95# the Makefile will pass version and release on the sphinx-build
96# command line, which override this.
97try:
98 extracted_version = None
99 with open(os.path.join(qemu_docdir, '../VERSION')) as f:
100 extracted_version = f.readline().strip()
101except:
102 pass
103finally:
104 if extracted_version:
105 version = release = extracted_version
106 else:
107 version = release = "unknown version"
Peter Maydell5329da62019-03-07 14:26:45 +0000108
109# The language for content autogenerated by Sphinx. Refer to documentation
110# for a list of supported languages.
111#
112# This is also used if you do content translation via gettext catalogs.
113# Usually you set "language" from the command line for these cases.
114language = None
115
116# List of patterns, relative to source directory, that match files and
117# directories to ignore when looking for source files.
118# This patterns also effect to html_static_path and html_extra_path
119exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
120
121# The name of the Pygments (syntax highlighting) style to use.
122pygments_style = 'sphinx'
123
124# If true, `todo` and `todoList` produce output, else they produce nothing.
125todo_include_todos = False
126
Peter Maydelle250e862019-03-07 14:26:46 +0000127# Sphinx defaults to warning about use of :option: for options not defined
128# with "option::" in the document being processed. Turn that off.
129suppress_warnings = ["ref.option"]
Peter Maydell5329da62019-03-07 14:26:45 +0000130
Peter Maydell27a296f2019-09-05 14:10:40 +0100131# The rst_epilog fragment is effectively included in every rST file.
132# We use it to define substitutions based on build config that
133# can then be used in the documentation. The fallback if the
134# environment variable is not set is for the benefit of readthedocs
135# style document building; our Makefile always sets the variable.
136confdir = os.getenv('CONFDIR', "/etc/qemu")
137rst_epilog = ".. |CONFDIR| replace:: ``" + confdir + "``\n"
Peter Maydellde1572c2020-02-28 15:36:00 +0000138# We slurp in the defs.rst.inc and literally include it into rst_epilog,
139# because Sphinx's include:: directive doesn't work with absolute paths
140# and there isn't any one single relative path that will work for all
141# documents and for both via-make and direct sphinx-build invocation.
142with open(os.path.join(qemu_docdir, 'defs.rst.inc')) as f:
143 rst_epilog += f.read()
Peter Maydell27a296f2019-09-05 14:10:40 +0100144
Peter Maydell5329da62019-03-07 14:26:45 +0000145# -- Options for HTML output ----------------------------------------------
146
147# The theme to use for HTML and HTML Help pages. See the documentation for
148# a list of builtin themes.
149#
150html_theme = 'alabaster'
151
152# Theme options are theme-specific and customize the look and feel of a theme
153# further. For a list of options available for each theme, see the
154# documentation.
Peter Maydellf8cf7142019-03-07 14:26:46 +0000155# We initialize this to empty here, so the per-manual conf.py can just
156# add individual key/value entries.
157html_theme_options = {
158}
Peter Maydell5329da62019-03-07 14:26:45 +0000159
160# Add any paths that contain custom static files (such as style sheets) here,
161# relative to this directory. They are copied after the builtin static files,
162# so a file named "default.css" will overwrite the builtin "default.css".
Peter Maydell07fd6562019-03-07 14:26:45 +0000163# QEMU doesn't yet have any static files, so comment this out so we don't
164# get a warning about a missing directory.
165# If we do ever add this then it would probably be better to call the
166# subdirectory sphinx_static, as the Linux kernel does.
167# html_static_path = ['_static']
Peter Maydell5329da62019-03-07 14:26:45 +0000168
169# Custom sidebar templates, must be a dictionary that maps document names
170# to template names.
171#
172# This is required for the alabaster theme
173# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
174html_sidebars = {
175 '**': [
Peter Maydell4fad3862019-03-07 14:26:45 +0000176 'about.html',
177 'navigation.html',
Peter Maydell5329da62019-03-07 14:26:45 +0000178 'searchbox.html',
179 ]
180}
181
Peter Maydell479fb8a2019-03-07 14:26:46 +0000182# Don't copy the rST source files to the HTML output directory,
183# and don't put links to the sources into the output HTML.
184html_copy_source = False
Peter Maydell5329da62019-03-07 14:26:45 +0000185
186# -- Options for HTMLHelp output ------------------------------------------
187
188# Output file base name for HTML help builder.
189htmlhelp_basename = 'QEMUdoc'
190
191
192# -- Options for LaTeX output ---------------------------------------------
193
194latex_elements = {
195 # The paper size ('letterpaper' or 'a4paper').
196 #
197 # 'papersize': 'letterpaper',
198
199 # The font size ('10pt', '11pt' or '12pt').
200 #
201 # 'pointsize': '10pt',
202
203 # Additional stuff for the LaTeX preamble.
204 #
205 # 'preamble': '',
206
207 # Latex figure (float) alignment
208 #
209 # 'figure_align': 'htbp',
210}
211
212# Grouping the document tree into LaTeX files. List of tuples
213# (source start file, target name, title,
214# author, documentclass [howto, manual, or own class]).
215latex_documents = [
216 (master_doc, 'QEMU.tex', u'QEMU Documentation',
217 u'The QEMU Project Developers', 'manual'),
218]
219
220
221# -- Options for manual page output ---------------------------------------
Peter Maydell27a296f2019-09-05 14:10:40 +0100222# Individual manual/conf.py can override this to create man pages
223man_pages = []
Peter Maydell5329da62019-03-07 14:26:45 +0000224
225# -- Options for Texinfo output -------------------------------------------
226
227# Grouping the document tree into Texinfo files. List of tuples
228# (source start file, target name, title, author,
229# dir menu entry, description, category)
230texinfo_documents = [
231 (master_doc, 'QEMU', u'QEMU Documentation',
232 author, 'QEMU', 'One line description of project.',
233 'Miscellaneous'),
234]
235
236
237
Peter Maydell22b5ea72019-11-29 14:16:12 +0100238# We use paths starting from qemu_docdir here so that you can run
239# sphinx-build from anywhere and the kerneldoc extension can still
240# find everything.
241kerneldoc_bin = os.path.join(qemu_docdir, '../scripts/kernel-doc')
242kerneldoc_srctree = os.path.join(qemu_docdir, '..')
Peter Maydell6803d6e2020-01-24 16:26:01 +0000243hxtool_srctree = os.path.join(qemu_docdir, '..')