conf.py 5.1 KB

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