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" |
| 20 | |
| 21 | # String used in sidebar |
| 22 | version = 'Version: ' + current_version |
| 23 | if current_version == 'dev': |
| 24 | version = 'Version: Current Development' |
| 25 | # Version seen in documentation_options.js and hence in js switchers code |
| 26 | release = current_version |
| 27 | |
| 28 | |
| 29 | # -- Project information ----------------------------------------------------- |
Andrew Geissler | c3d88e4 | 2020-10-02 09:45:00 -0500 | [diff] [blame] | 30 | project = 'The Yocto Project \xae' |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 31 | copyright = '2010-%s, The Linux Foundation' % datetime.datetime.now().year |
| 32 | author = 'The Linux Foundation' |
| 33 | |
| 34 | # -- General configuration --------------------------------------------------- |
| 35 | |
| 36 | # to load local extension from the folder 'sphinx' |
| 37 | sys.path.insert(0, os.path.abspath('sphinx')) |
| 38 | |
| 39 | # Add any Sphinx extension module names here, as strings. They can be |
| 40 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
| 41 | # ones. |
| 42 | extensions = [ |
| 43 | 'sphinx.ext.autosectionlabel', |
| 44 | 'sphinx.ext.extlinks', |
| 45 | 'sphinx.ext.intersphinx', |
| 46 | 'yocto-vars' |
| 47 | ] |
| 48 | autosectionlabel_prefix_document = True |
| 49 | |
| 50 | # Add any paths that contain templates here, relative to this directory. |
| 51 | templates_path = ['_templates'] |
| 52 | |
| 53 | # List of patterns, relative to source directory, that match files and |
| 54 | # directories to ignore when looking for source files. |
| 55 | # This pattern also affects html_static_path and html_extra_path. |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 56 | exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'boilerplate.rst'] |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 57 | |
| 58 | # master document name. The default changed from contents to index. so better |
| 59 | # set it ourselves. |
| 60 | master_doc = 'index' |
| 61 | |
| 62 | # create substitution for project configuration variables |
| 63 | rst_prolog = """ |
| 64 | .. |project_name| replace:: %s |
| 65 | .. |copyright| replace:: %s |
| 66 | .. |author| replace:: %s |
| 67 | """ % (project, copyright, author) |
| 68 | |
| 69 | # external links and substitutions |
| 70 | extlinks = { |
Andrew Geissler | 706d5aa | 2021-02-12 15:55:30 -0600 | [diff] [blame] | 71 | 'yocto_home': ('https://yoctoproject.org%s', None), |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 72 | 'yocto_wiki': ('https://wiki.yoctoproject.org/wiki%s', None), |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 73 | 'yocto_dl': ('https://downloads.yoctoproject.org%s', None), |
| 74 | 'yocto_lists': ('https://lists.yoctoproject.org%s', None), |
| 75 | 'yocto_bugs': ('https://bugzilla.yoctoproject.org%s', None), |
| 76 | 'yocto_ab': ('https://autobuilder.yoctoproject.org%s', None), |
| 77 | 'yocto_docs': ('https://docs.yoctoproject.org%s', None), |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 78 | 'yocto_git': ('https://git.yoctoproject.org/cgit/cgit.cgi%s', None), |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 79 | 'oe_home': ('https://www.openembedded.org%s', None), |
| 80 | 'oe_lists': ('https://lists.openembedded.org%s', None), |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 81 | 'oe_git': ('https://git.openembedded.org%s', None), |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 82 | } |
| 83 | |
| 84 | # Intersphinx config to use cross reference with Bitbake user manual |
| 85 | intersphinx_mapping = { |
| 86 | 'bitbake': ('https://docs.yoctoproject.org/bitbake/', None) |
| 87 | } |
| 88 | |
| 89 | # -- Options for HTML output ------------------------------------------------- |
| 90 | |
| 91 | # The theme to use for HTML and HTML Help pages. See the documentation for |
| 92 | # a list of builtin themes. |
| 93 | # |
Andrew Geissler | c3d88e4 | 2020-10-02 09:45:00 -0500 | [diff] [blame] | 94 | try: |
| 95 | import sphinx_rtd_theme |
| 96 | html_theme = 'sphinx_rtd_theme' |
| 97 | html_theme_options = { |
| 98 | 'sticky_navigation': False, |
| 99 | } |
| 100 | except ImportError: |
| 101 | sys.stderr.write("The Sphinx sphinx_rtd_theme HTML theme was not found.\ |
| 102 | \nPlease make sure to install the sphinx_rtd_theme python package.\n") |
| 103 | sys.exit(1) |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 104 | |
| 105 | html_logo = 'sphinx-static/YoctoProject_Logo_RGB.jpg' |
| 106 | |
| 107 | # Add any paths that contain custom static files (such as style sheets) here, |
| 108 | # relative to this directory. They are copied after the builtin static files, |
| 109 | # so a file named "default.css" will overwrite the builtin "default.css". |
| 110 | html_static_path = ['sphinx-static'] |
| 111 | |
| 112 | html_context = { |
| 113 | 'current_version': current_version, |
| 114 | } |
| 115 | |
| 116 | # Add customm CSS and JS files |
| 117 | html_css_files = ['theme_overrides.css'] |
| 118 | html_js_files = ['switchers.js'] |
| 119 | |
| 120 | # Hide 'Created using Sphinx' text |
| 121 | html_show_sphinx = False |
| 122 | |
| 123 | # Add 'Last updated' on each page |
| 124 | html_last_updated_fmt = '%b %d, %Y' |
| 125 | |
| 126 | # Remove the trailing 'dot' in section numbers |
| 127 | html_secnumber_suffix = " " |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 128 | |
| 129 | latex_elements = { |
| 130 | 'passoptionstopackages': '\PassOptionsToPackage{bookmarksdepth=5}{hyperref}', |
| 131 | 'preamble': '\setcounter{tocdepth}{2}', |
| 132 | } |