2021-03-30 12:10:31 +02:00
|
|
|
# Zephyr documentation build configuration file.
|
|
|
|
# Reference: https://www.sphinx-doc.org/en/master/usage/configuration.html
|
2015-05-13 20:05:30 +02:00
|
|
|
|
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
|
2018-06-08 03:45:55 +02:00
|
|
|
if "ZEPHYR_BASE" not in os.environ:
|
2018-06-08 15:54:22 +02:00
|
|
|
sys.exit("$ZEPHYR_BASE environment variable undefined.")
|
2018-07-16 19:05:05 +02:00
|
|
|
ZEPHYR_BASE = os.path.abspath(os.environ["ZEPHYR_BASE"])
|
|
|
|
|
|
|
|
if "ZEPHYR_BUILD" not in os.environ:
|
|
|
|
sys.exit("$ZEPHYR_BUILD environment variable undefined.")
|
|
|
|
ZEPHYR_BUILD = os.path.abspath(os.environ["ZEPHYR_BUILD"])
|
2018-06-08 03:45:55 +02:00
|
|
|
|
doc: add zephyr-app-commands directive
Add extensions/zephyr to the documentation. This is where Sphinx
extensions customized for Zephyr will live.
Within, add application.py. This provides a directive,
zephyr-app-commands, which generates commands in the docs to build,
flash, debug, etc. an application. For now, these are Unix shell
specific. Later on, they can be customized to generate additional
formats, perhaps with extra options.
After this is used throughout the tree, doing this with an extension
enables global changes with changes to the directive implementation
only.
Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2017-11-03 21:46:33 +01:00
|
|
|
# Add the 'extensions' directory to sys.path, to enable finding Sphinx
|
|
|
|
# extensions within.
|
2021-03-29 20:51:57 +02:00
|
|
|
sys.path.insert(0, os.path.join(ZEPHYR_BASE, 'doc', '_extensions'))
|
2018-11-12 16:14:51 +01:00
|
|
|
|
2021-03-30 10:55:43 +02:00
|
|
|
# Add the '_scripts' directory to sys.path, to enable finding utility
|
|
|
|
# modules.
|
|
|
|
sys.path.insert(0, os.path.join(ZEPHYR_BASE, 'doc', '_scripts'))
|
|
|
|
|
2019-01-23 16:31:06 +01:00
|
|
|
# Add the directory which contains the runners package as well,
|
|
|
|
# for autodoc directives on runners.xyz.
|
|
|
|
sys.path.insert(0, os.path.join(ZEPHYR_BASE, 'scripts', 'west_commands'))
|
|
|
|
|
2021-03-30 10:55:43 +02:00
|
|
|
import redirects
|
|
|
|
|
2018-11-12 16:14:51 +01:00
|
|
|
try:
|
2019-07-22 19:00:59 +02:00
|
|
|
import west as west_found
|
|
|
|
except ImportError:
|
|
|
|
west_found = False
|
2015-05-13 20:05:30 +02:00
|
|
|
|
|
|
|
# -- General configuration ------------------------------------------------
|
|
|
|
|
|
|
|
extensions = [
|
2018-02-22 19:09:52 +01:00
|
|
|
'breathe', 'sphinx.ext.todo',
|
doc: add zephyr-app-commands directive
Add extensions/zephyr to the documentation. This is where Sphinx
extensions customized for Zephyr will live.
Within, add application.py. This provides a directive,
zephyr-app-commands, which generates commands in the docs to build,
flash, debug, etc. an application. For now, these are Unix shell
specific. Later on, they can be customized to generate additional
formats, perhaps with extra options.
After this is used throughout the tree, doing this with an extension
enables global changes with changes to the directive implementation
only.
Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2017-11-03 21:46:33 +01:00
|
|
|
'sphinx.ext.extlinks',
|
2018-06-08 04:07:00 +02:00
|
|
|
'sphinx.ext.autodoc',
|
doc: add zephyr-app-commands directive
Add extensions/zephyr to the documentation. This is where Sphinx
extensions customized for Zephyr will live.
Within, add application.py. This provides a directive,
zephyr-app-commands, which generates commands in the docs to build,
flash, debug, etc. an application. For now, these are Unix shell
specific. Later on, they can be customized to generate additional
formats, perhaps with extra options.
After this is used throughout the tree, doing this with an extension
enables global changes with changes to the directive implementation
only.
Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2017-11-03 21:46:33 +01:00
|
|
|
'zephyr.application',
|
2019-01-20 14:56:48 +01:00
|
|
|
'zephyr.html_redirects',
|
2019-01-20 16:48:54 +01:00
|
|
|
'only.eager_only',
|
doc: add new :dtcompatible: role / directive
This allows RST documentation to do something like this:
See :dtcompatible:`vnd,foo` for more information.
This is transformed into a link to documentation for the "vnd,foo"
compatible.
Some devicetree compatibles may be handled by multiple bindings.
This can happen when the binding file is bus-dependent. Therefore, to
make this work, we need to change the way gen_devicetree_rest.py works
to ensure we have a good source of information for this compatible
regardless of how many bindings are associated with as follows:
- When only a single binding is associated with a compatible, the
:dtcompatible: link goes directly to the per-binding HTML page.
- When multiple bindings are associated with a compatible, this goes
to a new generated "disambiguation" page which links to all the
per-binding pages.
To avoid clashes, we stick the disambiguation pages into a
compatibles/ subdirectory of the generated bindings index root
directory.
Also reorganize the generated bindings output directory into
.../bindings/subdir/binding.rst files. For example,
dts/bindings/arm/arm,dtcm.yaml now gets its generated content in
.../bindings/arm/arm,dtcm.rst.
This brings the 'category' of binding (like 'sensor', 'i2c', etc.)
into the URL, which is a useful hint.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-11-07 02:16:02 +01:00
|
|
|
'zephyr.dtcompatible-role',
|
2019-09-12 23:32:29 +02:00
|
|
|
'zephyr.link-roles',
|
|
|
|
'sphinx_tabs.tabs'
|
2015-05-13 20:05:30 +02:00
|
|
|
]
|
|
|
|
|
2018-08-23 20:11:11 +02:00
|
|
|
# Only use SVG converter when it is really needed, e.g. LaTeX.
|
2019-09-04 14:43:17 +02:00
|
|
|
if tags.has("svgconvert"): # pylint: disable=undefined-variable
|
2018-08-23 20:11:11 +02:00
|
|
|
extensions.append('sphinxcontrib.rsvgconverter')
|
|
|
|
|
2015-05-13 20:05:30 +02:00
|
|
|
templates_path = ['_templates']
|
|
|
|
|
2015-06-12 19:51:09 +02:00
|
|
|
project = u'Zephyr Project'
|
2021-03-19 10:42:21 +01:00
|
|
|
copyright = u'2015-2021 Zephyr Project members and individual contributors'
|
2019-01-06 23:21:04 +01:00
|
|
|
author = u'The Zephyr Project'
|
2015-05-13 20:05:30 +02:00
|
|
|
|
2016-12-23 18:25:06 +01:00
|
|
|
# The following code tries to extract the information by reading the Makefile,
|
|
|
|
# when Sphinx is run directly (e.g. by Read the Docs).
|
|
|
|
try:
|
2017-11-20 05:03:58 +01:00
|
|
|
version_major = None
|
|
|
|
version_minor = None
|
|
|
|
patchlevel = None
|
|
|
|
extraversion = None
|
2017-12-09 17:20:44 +01:00
|
|
|
for line in open(os.path.join(ZEPHYR_BASE, 'VERSION')):
|
2016-12-23 18:25:06 +01:00
|
|
|
key, val = [x.strip() for x in line.split('=', 2)]
|
|
|
|
if key == 'VERSION_MAJOR':
|
2017-11-20 05:03:58 +01:00
|
|
|
version_major = val
|
2016-12-23 18:25:06 +01:00
|
|
|
if key == 'VERSION_MINOR':
|
2017-11-20 05:03:58 +01:00
|
|
|
version_minor = val
|
2016-12-23 18:25:06 +01:00
|
|
|
elif key == 'PATCHLEVEL':
|
2017-11-20 05:03:58 +01:00
|
|
|
patchlevel = val
|
|
|
|
elif key == 'EXTRAVERSION':
|
|
|
|
extraversion = val
|
|
|
|
if version_major and version_minor and patchlevel and extraversion:
|
2016-12-23 18:25:06 +01:00
|
|
|
break
|
2019-09-05 19:03:58 +02:00
|
|
|
except Exception:
|
2016-12-23 18:25:06 +01:00
|
|
|
pass
|
|
|
|
finally:
|
2019-03-25 21:05:48 +01:00
|
|
|
if version_major and version_minor and patchlevel and extraversion is not None:
|
2017-11-20 05:03:58 +01:00
|
|
|
version = release = version_major + '.' + version_minor + '.' + patchlevel
|
|
|
|
if extraversion != '':
|
|
|
|
version = release = version + '-' + extraversion
|
2016-12-23 18:25:06 +01:00
|
|
|
else:
|
|
|
|
sys.stderr.write('Warning: Could not extract kernel version\n')
|
|
|
|
version = release = "unknown version"
|
2015-05-13 20:05:30 +02:00
|
|
|
|
|
|
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
|
|
|
# for a list of supported languages.
|
|
|
|
#
|
|
|
|
# This is also used if you do content translation via gettext catalogs.
|
|
|
|
# Usually you set "language" from the command line for these cases.
|
|
|
|
language = None
|
|
|
|
|
|
|
|
exclude_patterns = ['_build']
|
2018-11-12 16:14:51 +01:00
|
|
|
if not west_found:
|
|
|
|
exclude_patterns.append('**/*west-apis*')
|
|
|
|
else:
|
|
|
|
exclude_patterns.append('**/*west-not-found*')
|
2015-05-13 20:05:30 +02:00
|
|
|
|
2019-03-12 23:39:09 +01:00
|
|
|
# This change will allow us to use bare back-tick notation to let
|
|
|
|
# Sphinx hunt for a reference, starting with normal "document"
|
|
|
|
# references such as :ref:, but also including :c: and :cpp: domains
|
|
|
|
# (potentially) helping with API (doxygen) references simply by using
|
|
|
|
# `name`
|
|
|
|
default_role = 'any'
|
2015-05-13 20:05:30 +02:00
|
|
|
|
|
|
|
pygments_style = 'sphinx'
|
|
|
|
|
2018-02-08 10:48:01 +01:00
|
|
|
# Additional lexer for Pygments (syntax highlighting)
|
|
|
|
from lexer.DtsLexer import DtsLexer
|
|
|
|
from sphinx.highlighting import lexers
|
|
|
|
lexers['DTS'] = DtsLexer()
|
|
|
|
|
2015-08-07 19:22:27 +02:00
|
|
|
todo_include_todos = False
|
2015-06-12 19:51:09 +02:00
|
|
|
|
|
|
|
rst_epilog = """
|
2018-05-05 01:31:05 +02:00
|
|
|
.. include:: /substitutions.txt
|
2015-06-12 19:51:09 +02:00
|
|
|
"""
|
2015-05-13 20:05:30 +02:00
|
|
|
|
|
|
|
# -- Options for HTML output ----------------------------------------------
|
|
|
|
|
2018-08-04 01:12:03 +02:00
|
|
|
import sphinx_rtd_theme
|
|
|
|
html_theme = "sphinx_rtd_theme"
|
|
|
|
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
2019-06-27 22:45:00 +02:00
|
|
|
html_theme_options = {
|
|
|
|
'prev_next_buttons_location': None
|
|
|
|
}
|
2017-01-04 15:39:45 +01:00
|
|
|
|
2019-09-04 14:43:17 +02:00
|
|
|
if tags.has('release'): # pylint: disable=undefined-variable
|
2017-11-18 01:02:11 +01:00
|
|
|
is_release = True
|
2017-05-19 14:36:20 +02:00
|
|
|
docs_title = 'Docs / %s' %(version)
|
|
|
|
else:
|
2017-11-18 01:02:11 +01:00
|
|
|
is_release = False
|
2018-03-02 23:01:52 +01:00
|
|
|
docs_title = 'Docs / Latest'
|
2017-05-19 14:36:20 +02:00
|
|
|
|
2015-06-29 21:33:28 +02:00
|
|
|
html_title = "Zephyr Project Documentation"
|
2015-05-13 20:05:30 +02:00
|
|
|
|
2018-07-31 22:47:10 +02:00
|
|
|
html_logo = 'images/Zephyr-Kite-logo.png'
|
2015-05-13 20:05:30 +02:00
|
|
|
|
2018-07-26 22:30:42 +02:00
|
|
|
html_favicon = 'images/zp_favicon.png'
|
2015-05-13 20:05:30 +02:00
|
|
|
|
2021-03-29 20:46:59 +02:00
|
|
|
html_static_path = ['{}/doc/_static'.format(ZEPHYR_BASE)]
|
2015-05-13 20:05:30 +02:00
|
|
|
|
2015-05-28 13:43:26 +02:00
|
|
|
html_last_updated_fmt = '%b %d, %Y'
|
2015-05-13 20:05:30 +02:00
|
|
|
|
2015-08-07 19:22:27 +02:00
|
|
|
html_domain_indices = False
|
2015-05-13 20:05:30 +02:00
|
|
|
|
2015-08-07 19:22:27 +02:00
|
|
|
html_split_index = True
|
2015-05-13 20:05:30 +02:00
|
|
|
|
2018-07-31 22:47:10 +02:00
|
|
|
html_show_sourcelink = False
|
2015-05-13 20:05:30 +02:00
|
|
|
|
2015-10-16 16:30:15 +02:00
|
|
|
html_show_sphinx = False
|
2015-05-13 20:05:30 +02:00
|
|
|
|
2021-03-29 23:47:39 +02:00
|
|
|
html_search_scorer = '_static/js/scorer.js'
|
2015-05-13 20:05:30 +02:00
|
|
|
|
2021-03-30 10:55:43 +02:00
|
|
|
html_redirect_pages = redirects.REDIRECTS
|
2019-01-20 14:56:48 +01:00
|
|
|
|
2015-05-13 20:05:30 +02:00
|
|
|
# -- Options for LaTeX output ---------------------------------------------
|
|
|
|
|
|
|
|
latex_elements = {
|
2021-03-30 10:30:00 +02:00
|
|
|
'preamble': r'\setcounter{tocdepth}{2}',
|
2015-05-13 20:05:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
latex_documents = [
|
2021-03-30 10:41:27 +02:00
|
|
|
('index', 'zephyr.tex', u'Zephyr Project Documentation',
|
2015-05-13 20:05:30 +02:00
|
|
|
u'many', 'manual'),
|
|
|
|
]
|
|
|
|
|
2015-05-15 18:35:25 +02:00
|
|
|
breathe_projects = {
|
2018-07-16 19:05:05 +02:00
|
|
|
"Zephyr": "{}/doxygen/xml".format(ZEPHYR_BUILD),
|
|
|
|
"doc-examples": "{}/doxygen/xml".format(ZEPHYR_BUILD)
|
2015-05-13 20:05:30 +02:00
|
|
|
}
|
2015-06-12 19:51:09 +02:00
|
|
|
breathe_default_project = "Zephyr"
|
2015-10-16 16:30:15 +02:00
|
|
|
|
2020-05-18 22:46:26 +02:00
|
|
|
breathe_domain_by_extension = {
|
|
|
|
"h": "c",
|
|
|
|
"c": "c",
|
|
|
|
}
|
2020-09-05 01:23:04 +02:00
|
|
|
breathe_separate_member_pages = True
|
2020-10-23 12:40:49 +02:00
|
|
|
breathe_show_enumvalue_initializer = True
|
2019-03-12 23:39:09 +01:00
|
|
|
|
2020-06-01 13:57:27 +02:00
|
|
|
cpp_id_attributes = [
|
|
|
|
'__syscall', '__deprecated', '__may_alias',
|
|
|
|
'__used', '__unused', '__weak',
|
|
|
|
'__DEPRECATED_MACRO', 'FUNC_NORETURN',
|
|
|
|
'__subsystem',
|
|
|
|
]
|
|
|
|
c_id_attributes = cpp_id_attributes
|
2017-09-29 20:31:46 +02:00
|
|
|
|
2017-05-18 21:34:46 +02:00
|
|
|
# docs_title is used in the breadcrumb title in the zephyr docs theme
|
2015-10-16 16:30:15 +02:00
|
|
|
html_context = {
|
2021-03-30 10:41:27 +02:00
|
|
|
'show_license': True,
|
2017-05-19 14:36:20 +02:00
|
|
|
'docs_title': docs_title,
|
2017-11-18 01:02:11 +01:00
|
|
|
'is_release': is_release,
|
2018-07-31 22:47:10 +02:00
|
|
|
'theme_logo_only': False,
|
2018-07-26 22:30:42 +02:00
|
|
|
'current_version': version,
|
2019-09-06 11:13:19 +02:00
|
|
|
'versions': (("latest", "/"),
|
2021-02-12 16:29:36 +01:00
|
|
|
("2.5.0", "/2.5.0/"),
|
2020-09-26 18:38:42 +02:00
|
|
|
("2.4.0", "/2.4.0/"),
|
2020-06-05 20:47:08 +02:00
|
|
|
("2.3.0", "/2.3.0/"),
|
2020-03-10 08:53:11 +01:00
|
|
|
("2.2.0", "/2.2.0/"),
|
2019-10-08 01:51:36 +02:00
|
|
|
("1.14.1", "/1.14.1/"),
|
2018-07-26 22:30:42 +02:00
|
|
|
)
|
2015-10-16 16:30:15 +02:00
|
|
|
}
|
2017-01-03 20:43:02 +01:00
|
|
|
|
2019-01-20 14:56:48 +01:00
|
|
|
|
2017-09-29 20:31:46 +02:00
|
|
|
extlinks = {'jira': ('https://jira.zephyrproject.org/browse/%s', ''),
|
|
|
|
'github': ('https://github.com/zephyrproject-rtos/zephyr/issues/%s', '')
|
|
|
|
}
|
2017-01-28 01:20:21 +01:00
|
|
|
|
2017-04-27 23:59:04 +02:00
|
|
|
# some configuration for linkcheck builder
|
|
|
|
# noticed that we're getting false-positive link errors on JIRA, I suspect
|
|
|
|
# because it's taking too long for the server to respond so bump up the
|
|
|
|
# timeout (default=5) and turn off anchor checks (so only a HEAD request is
|
|
|
|
# done - much faster) Leave the ignore commented in case we want to remove
|
|
|
|
# jira link checks later...
|
|
|
|
|
|
|
|
linkcheck_timeout = 30
|
|
|
|
linkcheck_workers = 10
|
|
|
|
# linkcheck_ignore = [r'https://jira\.zephyrproject\.org/']
|
|
|
|
linkcheck_anchors = False
|
|
|
|
|
2017-01-28 01:20:21 +01:00
|
|
|
def setup(app):
|
2021-03-29 23:48:48 +02:00
|
|
|
app.add_css_file("css/zephyr-custom.css")
|
2019-06-06 23:13:56 +02:00
|
|
|
|
2020-05-18 22:42:20 +02:00
|
|
|
app.add_js_file("https://www.googletagmanager.com/gtag/js?id=UA-831873-47")
|
2021-03-29 23:47:39 +02:00
|
|
|
app.add_js_file("js/ga-tracker.js")
|
|
|
|
app.add_js_file("js/zephyr-custom.js")
|