Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | #------------------------------------------------------------------------------- |
| 3 | # Copyright (c) 2019-2022, Arm Limited. All rights reserved. |
Minos Galanakis | d19a19f | 2020-06-03 15:38:03 +0100 | [diff] [blame] | 4 | # |
| 5 | # SPDX-License-Identifier: BSD-3-Clause |
| 6 | # |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 7 | #------------------------------------------------------------------------------- |
| 8 | |
| 9 | # Configuration file for the Sphinx documentation builder. |
Minos Galanakis | d19a19f | 2020-06-03 15:38:03 +0100 | [diff] [blame] | 10 | # |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 11 | # This file does only contain a selection of the most common options. For a |
| 12 | # full list see the documentation: |
| 13 | # http://www.sphinx-doc.org/en/master/config |
| 14 | |
Minos Galanakis | d19a19f | 2020-06-03 15:38:03 +0100 | [diff] [blame] | 15 | import os |
| 16 | import sys |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 17 | import re |
| 18 | from subprocess import check_output |
Minos Galanakis | d19a19f | 2020-06-03 15:38:03 +0100 | [diff] [blame] | 19 | |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 20 | # -- Project information ----------------------------------------------------- |
Minos Galanakis | d19a19f | 2020-06-03 15:38:03 +0100 | [diff] [blame] | 21 | |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 22 | project = 'Trusted Firmware-M' |
| 23 | copyright = '2017-2022, ARM CE-OSS' |
| 24 | author = 'ARM CE-OSS' |
| 25 | title = 'User Guide' |
Minos Galanakis | d19a19f | 2020-06-03 15:38:03 +0100 | [diff] [blame] | 26 | |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 27 | # -- Extract current version ------------------------------------------------- |
Minos Galanakis | d19a19f | 2020-06-03 15:38:03 +0100 | [diff] [blame] | 28 | |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 29 | try: |
| 30 | vrex = re.compile(r'TF-M(?P<GIT_VERSION>v.+?)' |
| 31 | r'(-[0-9]+-g)?(?P<GIT_SHA>[a-f0-9]{7,})?$') |
Minos Galanakis | d19a19f | 2020-06-03 15:38:03 +0100 | [diff] [blame] | 32 | |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 33 | version = check_output("git describe --tags --always", |
| 34 | shell = True, encoding = 'UTF-8') |
| 35 | |
| 36 | _v = vrex.match(version) |
| 37 | release = _v.group('GIT_VERSION') |
| 38 | if _v.group('GIT_SHA'): |
| 39 | version = release + "+" + _v.group('GIT_SHA')[:7] |
| 40 | |
| 41 | except: |
| 42 | version = release = 'Unknown' |
| 43 | |
| 44 | # -- General configuration --------------------------------------------------- |
| 45 | |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 46 | extensions = [ |
| 47 | 'sphinx.ext.imgmath', |
| 48 | 'm2r2', #Support markdown files. Needed for external code. |
| 49 | 'sphinx.ext.autosectionlabel', #Make sphinx generate a label for each section |
| 50 | 'sphinxcontrib.plantuml', #Add support for PlantUML drawings |
| 51 | 'sphinxcontrib.rsvgconverter', #Add support for SVG to PDF |
| 52 | 'sphinx_tabs.tabs' #Enable tab extension in Sphinx |
| 53 | ] |
| 54 | |
| 55 | # PlantUML |
| 56 | plantuml = 'java -jar ' + os.environ['PLANTUML_JAR_PATH'] |
| 57 | |
Anton Komlev | 6f1e549 | 2022-06-16 19:08:57 +0100 | [diff] [blame^] | 58 | # Make auto section labels generated be prefixed with file name. |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 59 | autosectionlabel_prefix_document=True |
Anton Komlev | 6f1e549 | 2022-06-16 19:08:57 +0100 | [diff] [blame^] | 60 | # Add auto section label for level 2 headers only. |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 61 | autosectionlabel_maxdepth=2 |
| 62 | |
| 63 | # Add any paths that contain templates here, relative to this directory. |
| 64 | templates_path = ['_templates'] |
| 65 | |
| 66 | # The suffix(es) of source filenames. |
| 67 | # You can specify multiple suffix as a list of string: |
| 68 | # |
| 69 | source_suffix = ['.rst', '.md'] |
| 70 | |
| 71 | # The master toctree document. |
| 72 | master_doc = 'index' |
| 73 | |
| 74 | # The language for content autogenerated by Sphinx. Refer to documentation |
| 75 | # for a list of supported languages. |
| 76 | # |
| 77 | # This is also used if you do content translation via gettext catalogs. |
| 78 | # Usually you set "language" from the command line for these cases. |
| 79 | language = None |
| 80 | |
| 81 | # List of patterns, relative to source directory, that match files and |
| 82 | # directories to ignore when looking for source files. |
| 83 | # This pattern also affects html_static_path and html_extra_path . |
| 84 | exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'readme.rst', |
| 85 | 'platform/ext/target/cypress/psoc64/security/keys/readme.rst', |
| 86 | 'lib/ext/**'] |
| 87 | |
| 88 | # The name of the Pygments (syntax highlighting) style to use. |
| 89 | pygments_style = 'sphinx' |
| 90 | |
| 91 | # -- Options for HTML output ------------------------------------------------- |
| 92 | |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 93 | html_theme = 'sphinx_rtd_theme' |
| 94 | |
Anton Komlev | 8e44834 | 2022-04-06 10:19:35 +0100 | [diff] [blame] | 95 | html_theme_options = { |
Anton Komlev | 91281f0 | 2022-04-22 09:24:20 +0100 | [diff] [blame] | 96 | 'collapse_navigation' : False, |
| 97 | 'prev_next_buttons_location' : None, # Hide Prev and Next buttons |
Anton Komlev | 6f1e549 | 2022-06-16 19:08:57 +0100 | [diff] [blame^] | 98 | 'display_version': True, # Show version under logo |
Anton Komlev | 91281f0 | 2022-04-22 09:24:20 +0100 | [diff] [blame] | 99 | 'sticky_navigation': True, |
| 100 | 'navigation_depth': 2, |
Anton Komlev | 8e44834 | 2022-04-06 10:19:35 +0100 | [diff] [blame] | 101 | } |
| 102 | |
| 103 | # Remove the "View page source" link from the top of docs pages |
| 104 | html_show_sourcelink = False |
| 105 | |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 106 | # Add any paths that contain custom static files (such as style sheets) here, |
| 107 | # relative to configuration directory. They are copied after the builtin static |
| 108 | # files, so a file named "default.css" will overwrite the builtin "default.css". |
| 109 | html_static_path = ['_static'] |
| 110 | |
| 111 | # Set the documentation logo relative to configuration directory |
| 112 | html_logo = '_static/images/tf_logo_white.png' |
| 113 | |
Anton Komlev | 8e44834 | 2022-04-06 10:19:35 +0100 | [diff] [blame] | 114 | # Set the documentation favicon |
| 115 | html_favicon = '_static/images/favicon.ico' |
| 116 | |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 117 | #Disable adding conf.py copyright notice to HTML output |
| 118 | html_show_copyright = False |
| 119 | |
Anton Komlev | 8e44834 | 2022-04-06 10:19:35 +0100 | [diff] [blame] | 120 | # Disable showing Sphinx footer message: |
| 121 | # "Built with Sphinx using a theme provided by Read the Docs. " |
| 122 | html_show_sphinx = False |
| 123 | |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 124 | #Add custom css for HTML. Used to allow full page width rendering |
| 125 | def setup(app): |
| 126 | app.add_css_file('css/tfm_custom.css') |
| 127 | |
| 128 | # -- Options for HTMLHelp output --------------------------------------------- |
| 129 | |
| 130 | # Output file base name for HTML help builder. |
| 131 | htmlhelp_basename = 'TF-M doc' |
| 132 | |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 133 | # Enable figures and tables auto numbering |
| 134 | numfig = True |
| 135 | numfig_secnum_depth = 0 |
| 136 | numfig_format = { |
| 137 | 'figure': 'Figure %s:', |
| 138 | 'table': 'Table %s:', |
| 139 | 'code-block': 'Listing %s:', |
| 140 | 'section': '%s' |
| 141 | } |
| 142 | |
| 143 | # -- Options for LaTeX output ------------------------------------------------ |
| 144 | |
| 145 | latex_elements = { |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 146 | # 'papersize': 'letterpaper', |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 147 | # 'pointsize': '10pt', |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 148 | # 'preamble': '', |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 149 | # 'figure_align': 'htbp', |
| 150 | } |
| 151 | |
| 152 | # Grouping the document tree into LaTeX files. List of tuples |
| 153 | # (source start file, target name, title, |
| 154 | # author, documentclass [howto, manual, or own class]). |
| 155 | latex_documents = [ |
| 156 | (master_doc, 'TF-M.tex', title, |
| 157 | author, 'manual'), |
| 158 | ] |
| 159 | |