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 | |
| 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 Maydell | e22684e | 2020-03-30 13:18:59 +0100 | [diff] [blame] | 36 | # 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... |
Thomas Huth | 1b11f28 | 2020-09-25 16:40:27 +0100 | [diff] [blame] | 39 | if sys.version_info < (3,6): |
Peter Maydell | e22684e | 2020-03-30 13:18:59 +0100 | [diff] [blame] | 40 | raise ConfigError( |
Thomas Huth | 1b11f28 | 2020-09-25 16:40:27 +0100 | [diff] [blame] | 41 | "QEMU requires a Sphinx that uses Python 3.6 or better\n") |
Peter Maydell | f8cf714 | 2019-03-07 14:26:46 +0000 | [diff] [blame] | 42 | |
| 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. |
| 46 | try: |
| 47 | qemu_docdir |
| 48 | except NameError: |
| 49 | qemu_docdir = os.path.abspath(".") |
| 50 | |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 51 | # 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 Maydell | f8cf714 | 2019-03-07 14:26:46 +0000 | [diff] [blame] | 53 | # documentation root, use an absolute path starting from qemu_docdir. |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 54 | # |
Peter Maydell | 4078ee5 | 2020-09-25 17:23:02 +0100 | [diff] [blame] | 55 | # Our extensions are in docs/sphinx; the qapidoc extension requires |
| 56 | # the QAPI modules from scripts/. |
John Snow | cd231e1 | 2019-07-10 15:08:06 -0400 | [diff] [blame] | 57 | sys.path.insert(0, os.path.join(qemu_docdir, "sphinx")) |
Peter Maydell | 4078ee5 | 2020-09-25 17:23:02 +0100 | [diff] [blame] | 58 | sys.path.insert(0, os.path.join(qemu_docdir, "../scripts")) |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 59 | |
| 60 | |
| 61 | # -- General configuration ------------------------------------------------ |
| 62 | |
| 63 | # If your documentation needs a minimal Sphinx version, state it here. |
| 64 | # |
Peter Maydell | bf3f857 | 2020-04-14 13:41:14 +0100 | [diff] [blame] | 65 | # Sphinx 1.5 and earlier can't build our docs because they are too |
| 66 | # picky about the syntax of the argument to the option:: directive |
| 67 | # (see Sphinx bugs #646, #3366). |
| 68 | needs_sphinx = '1.6' |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 69 | |
| 70 | # Add any Sphinx extension module names here, as strings. They can be |
| 71 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
| 72 | # ones. |
Peter Maydell | 4078ee5 | 2020-09-25 17:23:02 +0100 | [diff] [blame] | 73 | extensions = ['kerneldoc', 'qmp_lexer', 'hxtool', 'depfile', 'qapidoc'] |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 74 | |
| 75 | # Add any paths that contain templates here, relative to this directory. |
| 76 | templates_path = ['_templates'] |
| 77 | |
| 78 | # The suffix(es) of source filenames. |
| 79 | # You can specify multiple suffix as a list of string: |
| 80 | # |
| 81 | # source_suffix = ['.rst', '.md'] |
| 82 | source_suffix = '.rst' |
| 83 | |
| 84 | # The master toctree document. |
| 85 | master_doc = 'index' |
| 86 | |
| 87 | # General information about the project. |
| 88 | project = u'QEMU' |
Peter Maydell | 9b26a61 | 2020-03-16 11:20:06 +0000 | [diff] [blame] | 89 | copyright = u'2020, The QEMU Project Developers' |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 90 | author = u'The QEMU Project Developers' |
| 91 | |
| 92 | # The version info for the project you're documenting, acts as replacement for |
| 93 | # |version| and |release|, also used in various other places throughout the |
| 94 | # built documents. |
Peter Maydell | 6038f5f | 2019-03-07 14:26:47 +0000 | [diff] [blame] | 95 | |
| 96 | # Extract this information from the VERSION file, for the benefit of |
| 97 | # standalone Sphinx runs as used by readthedocs.org. Builds run from |
| 98 | # the Makefile will pass version and release on the sphinx-build |
| 99 | # command line, which override this. |
| 100 | try: |
| 101 | extracted_version = None |
| 102 | with open(os.path.join(qemu_docdir, '../VERSION')) as f: |
| 103 | extracted_version = f.readline().strip() |
| 104 | except: |
| 105 | pass |
| 106 | finally: |
| 107 | if extracted_version: |
| 108 | version = release = extracted_version |
| 109 | else: |
| 110 | version = release = "unknown version" |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 111 | |
| 112 | # The language for content autogenerated by Sphinx. Refer to documentation |
| 113 | # for a list of supported languages. |
| 114 | # |
| 115 | # This is also used if you do content translation via gettext catalogs. |
| 116 | # Usually you set "language" from the command line for these cases. |
| 117 | language = None |
| 118 | |
| 119 | # List of patterns, relative to source directory, that match files and |
| 120 | # directories to ignore when looking for source files. |
| 121 | # This patterns also effect to html_static_path and html_extra_path |
| 122 | exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] |
| 123 | |
| 124 | # The name of the Pygments (syntax highlighting) style to use. |
| 125 | pygments_style = 'sphinx' |
| 126 | |
| 127 | # If true, `todo` and `todoList` produce output, else they produce nothing. |
| 128 | todo_include_todos = False |
| 129 | |
Peter Maydell | e250e86 | 2019-03-07 14:26:46 +0000 | [diff] [blame] | 130 | # Sphinx defaults to warning about use of :option: for options not defined |
| 131 | # with "option::" in the document being processed. Turn that off. |
| 132 | suppress_warnings = ["ref.option"] |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 133 | |
Peter Maydell | 27a296f | 2019-09-05 14:10:40 +0100 | [diff] [blame] | 134 | # The rst_epilog fragment is effectively included in every rST file. |
| 135 | # We use it to define substitutions based on build config that |
| 136 | # can then be used in the documentation. The fallback if the |
| 137 | # environment variable is not set is for the benefit of readthedocs |
| 138 | # style document building; our Makefile always sets the variable. |
| 139 | confdir = os.getenv('CONFDIR', "/etc/qemu") |
| 140 | rst_epilog = ".. |CONFDIR| replace:: ``" + confdir + "``\n" |
Peter Maydell | de1572c | 2020-02-28 15:36:00 +0000 | [diff] [blame] | 141 | # We slurp in the defs.rst.inc and literally include it into rst_epilog, |
| 142 | # because Sphinx's include:: directive doesn't work with absolute paths |
| 143 | # and there isn't any one single relative path that will work for all |
| 144 | # documents and for both via-make and direct sphinx-build invocation. |
| 145 | with open(os.path.join(qemu_docdir, 'defs.rst.inc')) as f: |
| 146 | rst_epilog += f.read() |
Peter Maydell | 27a296f | 2019-09-05 14:10:40 +0100 | [diff] [blame] | 147 | |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 148 | # -- Options for HTML output ---------------------------------------------- |
| 149 | |
| 150 | # The theme to use for HTML and HTML Help pages. See the documentation for |
| 151 | # a list of builtin themes. |
| 152 | # |
| 153 | html_theme = 'alabaster' |
| 154 | |
| 155 | # Theme options are theme-specific and customize the look and feel of a theme |
| 156 | # further. For a list of options available for each theme, see the |
| 157 | # documentation. |
Peter Maydell | f8cf714 | 2019-03-07 14:26:46 +0000 | [diff] [blame] | 158 | # We initialize this to empty here, so the per-manual conf.py can just |
| 159 | # add individual key/value entries. |
| 160 | html_theme_options = { |
| 161 | } |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 162 | |
| 163 | # Add any paths that contain custom static files (such as style sheets) here, |
| 164 | # relative to this directory. They are copied after the builtin static files, |
| 165 | # so a file named "default.css" will overwrite the builtin "default.css". |
Peter Maydell | 07fd656 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 166 | # QEMU doesn't yet have any static files, so comment this out so we don't |
| 167 | # get a warning about a missing directory. |
| 168 | # If we do ever add this then it would probably be better to call the |
| 169 | # subdirectory sphinx_static, as the Linux kernel does. |
| 170 | # html_static_path = ['_static'] |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 171 | |
| 172 | # Custom sidebar templates, must be a dictionary that maps document names |
| 173 | # to template names. |
| 174 | # |
| 175 | # This is required for the alabaster theme |
| 176 | # refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars |
| 177 | html_sidebars = { |
| 178 | '**': [ |
Peter Maydell | 4fad386 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 179 | 'about.html', |
Daniel P. Berrangé | 704a256 | 2020-11-02 13:09:26 +0000 | [diff] [blame] | 180 | 'editpage.html', |
Peter Maydell | 4fad386 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 181 | 'navigation.html', |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 182 | 'searchbox.html', |
| 183 | ] |
| 184 | } |
| 185 | |
Peter Maydell | 479fb8a | 2019-03-07 14:26:46 +0000 | [diff] [blame] | 186 | # Don't copy the rST source files to the HTML output directory, |
| 187 | # and don't put links to the sources into the output HTML. |
| 188 | html_copy_source = False |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 189 | |
| 190 | # -- Options for HTMLHelp output ------------------------------------------ |
| 191 | |
| 192 | # Output file base name for HTML help builder. |
| 193 | htmlhelp_basename = 'QEMUdoc' |
| 194 | |
| 195 | |
| 196 | # -- Options for LaTeX output --------------------------------------------- |
| 197 | |
| 198 | latex_elements = { |
| 199 | # The paper size ('letterpaper' or 'a4paper'). |
| 200 | # |
| 201 | # 'papersize': 'letterpaper', |
| 202 | |
| 203 | # The font size ('10pt', '11pt' or '12pt'). |
| 204 | # |
| 205 | # 'pointsize': '10pt', |
| 206 | |
| 207 | # Additional stuff for the LaTeX preamble. |
| 208 | # |
| 209 | # 'preamble': '', |
| 210 | |
| 211 | # Latex figure (float) alignment |
| 212 | # |
| 213 | # 'figure_align': 'htbp', |
| 214 | } |
| 215 | |
| 216 | # Grouping the document tree into LaTeX files. List of tuples |
| 217 | # (source start file, target name, title, |
| 218 | # author, documentclass [howto, manual, or own class]). |
| 219 | latex_documents = [ |
| 220 | (master_doc, 'QEMU.tex', u'QEMU Documentation', |
| 221 | u'The QEMU Project Developers', 'manual'), |
| 222 | ] |
| 223 | |
| 224 | |
| 225 | # -- Options for manual page output --------------------------------------- |
Peter Maydell | 27a296f | 2019-09-05 14:10:40 +0100 | [diff] [blame] | 226 | # Individual manual/conf.py can override this to create man pages |
| 227 | man_pages = [] |
Peter Maydell | 5329da6 | 2019-03-07 14:26:45 +0000 | [diff] [blame] | 228 | |
| 229 | # -- Options for Texinfo output ------------------------------------------- |
| 230 | |
| 231 | # Grouping the document tree into Texinfo files. List of tuples |
| 232 | # (source start file, target name, title, author, |
| 233 | # dir menu entry, description, category) |
| 234 | texinfo_documents = [ |
| 235 | (master_doc, 'QEMU', u'QEMU Documentation', |
| 236 | author, 'QEMU', 'One line description of project.', |
| 237 | 'Miscellaneous'), |
| 238 | ] |
| 239 | |
| 240 | |
| 241 | |
Peter Maydell | 22b5ea7 | 2019-11-29 14:16:12 +0100 | [diff] [blame] | 242 | # We use paths starting from qemu_docdir here so that you can run |
| 243 | # sphinx-build from anywhere and the kerneldoc extension can still |
| 244 | # find everything. |
Yonggang Luo | a94a689 | 2020-10-16 06:06:23 +0800 | [diff] [blame] | 245 | kerneldoc_bin = ['perl', os.path.join(qemu_docdir, '../scripts/kernel-doc')] |
Peter Maydell | 22b5ea7 | 2019-11-29 14:16:12 +0100 | [diff] [blame] | 246 | kerneldoc_srctree = os.path.join(qemu_docdir, '..') |
Peter Maydell | 6803d6e | 2020-01-24 16:26:01 +0000 | [diff] [blame] | 247 | hxtool_srctree = os.path.join(qemu_docdir, '..') |
Peter Maydell | 4078ee5 | 2020-09-25 17:23:02 +0100 | [diff] [blame] | 248 | qapidoc_srctree = os.path.join(qemu_docdir, '..') |