Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1 | # Configuration file for the Sphinx documentation builder. |
| 2 | # |
Andrew Geissler | f034379 | 2020-11-18 10:42:21 -0600 | [diff] [blame] | 3 | # SPDX-License-Identifier: CC-BY-SA-2.0-UK |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 4 | # |
| 5 | # This file only contains a selection of the most common options. For a full |
| 6 | # list see the documentation: |
| 7 | # https://www.sphinx-doc.org/en/master/usage/configuration.html |
| 8 | |
| 9 | # -- Path setup -------------------------------------------------------------- |
| 10 | |
| 11 | # If extensions (or modules to document with autodoc) are in another directory, |
| 12 | # add these directories to sys.path here. If the directory is relative to the |
| 13 | # documentation root, use os.path.abspath to make it absolute, like shown here. |
| 14 | # |
| 15 | import os |
| 16 | import sys |
| 17 | import datetime |
| 18 | |
| 19 | current_version = "dev" |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 20 | bitbake_version = "" # Leave empty for development branch |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 21 | |
| 22 | # String used in sidebar |
| 23 | version = 'Version: ' + current_version |
| 24 | if current_version == 'dev': |
| 25 | version = 'Version: Current Development' |
| 26 | # Version seen in documentation_options.js and hence in js switchers code |
| 27 | release = current_version |
| 28 | |
| 29 | |
| 30 | # -- Project information ----------------------------------------------------- |
Andrew Geissler | c3d88e4 | 2020-10-02 09:45:00 -0500 | [diff] [blame] | 31 | project = 'The Yocto Project \xae' |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 32 | copyright = '2010-%s, The Linux Foundation, CC-BY-SA-2.0-UK license' % datetime.datetime.now().year |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 33 | author = 'The Linux Foundation' |
| 34 | |
| 35 | # -- General configuration --------------------------------------------------- |
| 36 | |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 37 | # Prevent building with an outdated version of sphinx |
| 38 | needs_sphinx = "3.1" |
| 39 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 40 | # to load local extension from the folder 'sphinx' |
| 41 | sys.path.insert(0, os.path.abspath('sphinx')) |
| 42 | |
| 43 | # Add any Sphinx extension module names here, as strings. They can be |
| 44 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
| 45 | # ones. |
| 46 | extensions = [ |
| 47 | 'sphinx.ext.autosectionlabel', |
| 48 | 'sphinx.ext.extlinks', |
| 49 | 'sphinx.ext.intersphinx', |
| 50 | 'yocto-vars' |
| 51 | ] |
| 52 | autosectionlabel_prefix_document = True |
| 53 | |
| 54 | # Add any paths that contain templates here, relative to this directory. |
| 55 | templates_path = ['_templates'] |
| 56 | |
| 57 | # List of patterns, relative to source directory, that match files and |
| 58 | # directories to ignore when looking for source files. |
| 59 | # This pattern also affects html_static_path and html_extra_path. |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 60 | exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'boilerplate.rst'] |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 61 | |
| 62 | # master document name. The default changed from contents to index. so better |
| 63 | # set it ourselves. |
| 64 | master_doc = 'index' |
| 65 | |
| 66 | # create substitution for project configuration variables |
| 67 | rst_prolog = """ |
| 68 | .. |project_name| replace:: %s |
| 69 | .. |copyright| replace:: %s |
| 70 | .. |author| replace:: %s |
| 71 | """ % (project, copyright, author) |
| 72 | |
| 73 | # external links and substitutions |
| 74 | extlinks = { |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 75 | 'yocto_home': ('https://www.yoctoproject.org%s', None), |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 76 | 'yocto_wiki': ('https://wiki.yoctoproject.org/wiki%s', None), |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 77 | 'yocto_dl': ('https://downloads.yoctoproject.org%s', None), |
| 78 | 'yocto_lists': ('https://lists.yoctoproject.org%s', None), |
| 79 | 'yocto_bugs': ('https://bugzilla.yoctoproject.org%s', None), |
| 80 | 'yocto_ab': ('https://autobuilder.yoctoproject.org%s', None), |
| 81 | 'yocto_docs': ('https://docs.yoctoproject.org%s', None), |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 82 | 'yocto_git': ('https://git.yoctoproject.org/cgit/cgit.cgi%s', None), |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 83 | 'yocto_sstate': ('http://sstate.yoctoproject.org%s', None), |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 84 | 'oe_home': ('https://www.openembedded.org%s', None), |
| 85 | 'oe_lists': ('https://lists.openembedded.org%s', None), |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 86 | 'oe_git': ('https://git.openembedded.org%s', None), |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 87 | 'oe_wiki': ('https://www.openembedded.org/wiki%s', None), |
| 88 | 'oe_layerindex': ('https://layers.openembedded.org%s', None), |
| 89 | 'oe_layer': ('https://layers.openembedded.org/layerindex/branch/master/layer%s', None), |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 90 | } |
| 91 | |
| 92 | # Intersphinx config to use cross reference with Bitbake user manual |
| 93 | intersphinx_mapping = { |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 94 | 'bitbake': ('https://docs.yoctoproject.org/bitbake/' + bitbake_version, None) |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 95 | } |
| 96 | |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 97 | # Suppress "WARNING: unknown mimetype for ..." |
| 98 | suppress_warnings = ['epub.unknown_project_files'] |
| 99 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 100 | # -- Options for HTML output ------------------------------------------------- |
| 101 | |
| 102 | # The theme to use for HTML and HTML Help pages. See the documentation for |
| 103 | # a list of builtin themes. |
| 104 | # |
Andrew Geissler | c3d88e4 | 2020-10-02 09:45:00 -0500 | [diff] [blame] | 105 | try: |
| 106 | import sphinx_rtd_theme |
| 107 | html_theme = 'sphinx_rtd_theme' |
| 108 | html_theme_options = { |
| 109 | 'sticky_navigation': False, |
| 110 | } |
| 111 | except ImportError: |
| 112 | sys.stderr.write("The Sphinx sphinx_rtd_theme HTML theme was not found.\ |
| 113 | \nPlease make sure to install the sphinx_rtd_theme python package.\n") |
| 114 | sys.exit(1) |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 115 | |
| 116 | html_logo = 'sphinx-static/YoctoProject_Logo_RGB.jpg' |
| 117 | |
| 118 | # Add any paths that contain custom static files (such as style sheets) here, |
| 119 | # relative to this directory. They are copied after the builtin static files, |
| 120 | # so a file named "default.css" will overwrite the builtin "default.css". |
| 121 | html_static_path = ['sphinx-static'] |
| 122 | |
| 123 | html_context = { |
| 124 | 'current_version': current_version, |
| 125 | } |
| 126 | |
| 127 | # Add customm CSS and JS files |
| 128 | html_css_files = ['theme_overrides.css'] |
| 129 | html_js_files = ['switchers.js'] |
| 130 | |
| 131 | # Hide 'Created using Sphinx' text |
| 132 | html_show_sphinx = False |
| 133 | |
| 134 | # Add 'Last updated' on each page |
| 135 | html_last_updated_fmt = '%b %d, %Y' |
| 136 | |
| 137 | # Remove the trailing 'dot' in section numbers |
| 138 | html_secnumber_suffix = " " |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 139 | |
| 140 | latex_elements = { |
| 141 | 'passoptionstopackages': '\PassOptionsToPackage{bookmarksdepth=5}{hyperref}', |
| 142 | 'preamble': '\setcounter{tocdepth}{2}', |
| 143 | } |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 144 | |
| 145 | # Make the EPUB builder prefer PNG to SVG because of issues rendering Inkscape SVG |
| 146 | from sphinx.builders.epub3 import Epub3Builder |
| 147 | Epub3Builder.supported_image_types = ['image/png', 'image/gif', 'image/jpeg'] |