blob: 8ac708911b980f051168b8396776a5f53749767d [file] [log] [blame]
Anas Nashif06d380c2015-05-13 14:05:30 -04001# -*- coding: utf-8 -*-
2#
Anas Nashif089a10b2015-06-12 10:51:09 -07003# Zephyr documentation build configuration file, created by
Anas Nashif06d380c2015-05-13 14:05:30 -04004# sphinx-quickstart on Fri May 8 11:43:01 2015.
5#
6# This file is execfile()d with the current directory set to its
7# containing dir.
8#
9# Note that not all possible configuration values are present in this
10# autogenerated file.
11#
12# All configuration values have a default; values that are commented out
13# serve to show the default.
14
15import sys
16import os
Carles Cufi8d5259a2018-11-12 16:14:51 +010017from subprocess import CalledProcessError, check_output, DEVNULL
Anas Nashif06d380c2015-05-13 14:05:30 -040018
Marti Bolivar1c852dd2018-06-07 21:45:55 -040019if "ZEPHYR_BASE" not in os.environ:
Marti Bolivarf8251692018-06-08 09:54:22 -040020 sys.exit("$ZEPHYR_BASE environment variable undefined.")
Carles Cufie182dbc2018-07-16 19:05:05 +020021ZEPHYR_BASE = os.path.abspath(os.environ["ZEPHYR_BASE"])
22
23if "ZEPHYR_BUILD" not in os.environ:
24 sys.exit("$ZEPHYR_BUILD environment variable undefined.")
25ZEPHYR_BUILD = os.path.abspath(os.environ["ZEPHYR_BUILD"])
Marti Bolivar1c852dd2018-06-07 21:45:55 -040026
Marti Bolivar6092fb02017-11-03 16:46:33 -040027# Add the 'extensions' directory to sys.path, to enable finding Sphinx
28# extensions within.
Carles Cufie182dbc2018-07-16 19:05:05 +020029sys.path.insert(0, os.path.join(ZEPHYR_BASE, 'doc', 'extensions'))
Carles Cufi8d5259a2018-11-12 16:14:51 +010030
Marti Bolivarab822642019-01-23 08:31:06 -070031# Add the directory which contains the runners package as well,
32# for autodoc directives on runners.xyz.
33sys.path.insert(0, os.path.join(ZEPHYR_BASE, 'scripts', 'west_commands'))
34
Carles Cufi8d5259a2018-11-12 16:14:51 +010035west_found = False
36
37try:
38 desc = check_output(['west', 'list', '-f{abspath}', 'west'],
39 stderr=DEVNULL,
40 cwd=os.path.dirname(__file__))
41 west_path = desc.decode(sys.getdefaultencoding()).strip()
42 # Add west, to be able to pull in its API docs.
43 sys.path.append(os.path.join(west_path, 'src'))
44 west_found = True
45except FileNotFoundError as e:
46 # west not installed
47 pass
48except CalledProcessError as e:
49 # west not able to list itself
50 pass
Anas Nashif06d380c2015-05-13 14:05:30 -040051
52# -- General configuration ------------------------------------------------
53
54# If your documentation needs a minimal Sphinx version, state it here.
55#needs_sphinx = '1.0'
56
57# Add any Sphinx extension module names here, as strings. They can be
58# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
59# ones.
60extensions = [
David B. Kinder05e00f62018-02-22 10:09:52 -080061 'breathe', 'sphinx.ext.todo',
Marti Bolivar6092fb02017-11-03 16:46:33 -040062 'sphinx.ext.extlinks',
Marti Bolivar3a766ae2018-06-07 22:07:00 -040063 'sphinx.ext.autodoc',
Marti Bolivar6092fb02017-11-03 16:46:33 -040064 'zephyr.application',
Anas Nashif38a77792019-01-20 08:56:48 -050065 'zephyr.html_redirects',
Anas Nashif072c4662019-01-20 10:48:54 -050066 'only.eager_only',
67 'zephyr.link-roles'
Anas Nashif06d380c2015-05-13 14:05:30 -040068]
69
Daniel Leung9945e7f2018-08-23 11:11:11 -070070# Only use SVG converter when it is really needed, e.g. LaTeX.
71if tags.has("svgconvert"):
72 extensions.append('sphinxcontrib.rsvgconverter')
73
Anas Nashif06d380c2015-05-13 14:05:30 -040074# Add any paths that contain templates here, relative to this directory.
75templates_path = ['_templates']
76
77# The suffix(es) of source filenames.
78# You can specify multiple suffix as a list of string:
79# source_suffix = ['.rst', '.md']
80source_suffix = '.rst'
81
82# The encoding of source files.
83#source_encoding = 'utf-8-sig'
84
85# The master toctree document.
86master_doc = 'index'
87
88# General information about the project.
Anas Nashif089a10b2015-06-12 10:51:09 -070089project = u'Zephyr Project'
David B. Kinder2e1021d2018-12-27 16:57:55 -080090copyright = u'2015-2019 Zephyr Project members and individual contributors'
Anas Nashif5d911182019-01-06 17:21:04 -050091author = u'The Zephyr Project'
Anas Nashif06d380c2015-05-13 14:05:30 -040092
Anas Nashif762bd852016-12-23 12:25:06 -050093# The following code tries to extract the information by reading the Makefile,
94# when Sphinx is run directly (e.g. by Read the Docs).
95try:
Anas Nashifcb9390c2017-11-19 23:03:58 -050096 version_major = None
97 version_minor = None
98 patchlevel = None
99 extraversion = None
Anas Nashif75141782017-12-09 11:20:44 -0500100 for line in open(os.path.join(ZEPHYR_BASE, 'VERSION')):
Anas Nashif762bd852016-12-23 12:25:06 -0500101 key, val = [x.strip() for x in line.split('=', 2)]
102 if key == 'VERSION_MAJOR':
Anas Nashifcb9390c2017-11-19 23:03:58 -0500103 version_major = val
Anas Nashif762bd852016-12-23 12:25:06 -0500104 if key == 'VERSION_MINOR':
Anas Nashifcb9390c2017-11-19 23:03:58 -0500105 version_minor = val
Anas Nashif762bd852016-12-23 12:25:06 -0500106 elif key == 'PATCHLEVEL':
Anas Nashifcb9390c2017-11-19 23:03:58 -0500107 patchlevel = val
108 elif key == 'EXTRAVERSION':
109 extraversion = val
110 if version_major and version_minor and patchlevel and extraversion:
Anas Nashif762bd852016-12-23 12:25:06 -0500111 break
112except:
113 pass
114finally:
Anas Nashif75141782017-12-09 11:20:44 -0500115 if version_major and version_minor and patchlevel and extraversion is not None :
Anas Nashifcb9390c2017-11-19 23:03:58 -0500116 version = release = version_major + '.' + version_minor + '.' + patchlevel
117 if extraversion != '':
118 version = release = version + '-' + extraversion
Anas Nashif762bd852016-12-23 12:25:06 -0500119 else:
120 sys.stderr.write('Warning: Could not extract kernel version\n')
121 version = release = "unknown version"
Anas Nashif06d380c2015-05-13 14:05:30 -0400122
123# The language for content autogenerated by Sphinx. Refer to documentation
124# for a list of supported languages.
125#
126# This is also used if you do content translation via gettext catalogs.
127# Usually you set "language" from the command line for these cases.
128language = None
129
130# There are two options for replacing |today|: either, you set today to some
131# non-false value, then it is used:
132#today = ''
133# Else, today_fmt is used as the format for a strftime call.
134#today_fmt = '%B %d, %Y'
135
136# List of patterns, relative to source directory, that match files and
137# directories to ignore when looking for source files.
138exclude_patterns = ['_build']
Carles Cufi8d5259a2018-11-12 16:14:51 +0100139if not west_found:
140 exclude_patterns.append('**/*west-apis*')
141else:
142 exclude_patterns.append('**/*west-not-found*')
Anas Nashif06d380c2015-05-13 14:05:30 -0400143
144# The reST default role (used for this markup: `text`) to use for all
145# documents.
146#default_role = None
147
148# If true, '()' will be appended to :func: etc. cross-reference text.
149#add_function_parentheses = True
150
151# If true, the current module name will be prepended to all description
152# unit titles (such as .. function::).
153#add_module_names = True
154
155# If true, sectionauthor and moduleauthor directives will be shown in the
156# output. They are ignored by default.
157#show_authors = False
158
159# The name of the Pygments (syntax highlighting) style to use.
160pygments_style = 'sphinx'
161
Bobby Noeltea5a29e42018-02-08 10:48:01 +0100162# Additional lexer for Pygments (syntax highlighting)
163from lexer.DtsLexer import DtsLexer
164from sphinx.highlighting import lexers
165lexers['DTS'] = DtsLexer()
166
Anas Nashif06d380c2015-05-13 14:05:30 -0400167# A list of ignored prefixes for module index sorting.
168#modindex_common_prefix = []
169
170# If true, keep warnings as "system message" paragraphs in the built documents.
171#keep_warnings = False
172
173# If true, `todo` and `todoList` produce output, else they produce nothing.
Carol Lee1aa77332015-08-07 13:22:27 -0400174todo_include_todos = False
Anas Nashif089a10b2015-06-12 10:51:09 -0700175
176rst_epilog = """
David B. Kinder486c5a52018-05-04 16:31:05 -0700177.. include:: /substitutions.txt
Anas Nashif089a10b2015-06-12 10:51:09 -0700178"""
Anas Nashif06d380c2015-05-13 14:05:30 -0400179
Anas Nashif06d380c2015-05-13 14:05:30 -0400180# -- Options for HTML output ----------------------------------------------
181
David B. Kinder5c8398d2018-08-03 16:12:03 -0700182import sphinx_rtd_theme
183html_theme = "sphinx_rtd_theme"
184html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
Anas Nashif457ae382017-01-04 09:39:45 -0500185
Anas Nashif3ba693f2017-05-19 08:36:20 -0400186if tags.has('release'):
Anas Nashifb53d6972017-11-17 19:02:11 -0500187 is_release = True
Anas Nashif3ba693f2017-05-19 08:36:20 -0400188 docs_title = 'Docs / %s' %(version)
189else:
Anas Nashifb53d6972017-11-17 19:02:11 -0500190 is_release = False
David B. Kinder5229f872018-03-02 14:01:52 -0800191 docs_title = 'Docs / Latest'
Anas Nashif3ba693f2017-05-19 08:36:20 -0400192
Anas Nashif06d380c2015-05-13 14:05:30 -0400193# The name for this set of Sphinx documents. If None, it defaults to
194# "<project> v<release> documentation".
Anas Nashif12867502015-06-29 15:33:28 -0400195html_title = "Zephyr Project Documentation"
Anas Nashif06d380c2015-05-13 14:05:30 -0400196
Yannis Damigosab1c6a12016-03-02 10:38:49 +0200197# This value determines the text for the permalink; it defaults to "¶".
198# Set it to None or the empty string to disable permalinks.
David B. Kinder4031da82017-02-06 09:51:15 -0800199#html_add_permalinks = ""
Rodrigo Caballero8d7b52f2015-10-16 09:30:15 -0500200
Anas Nashif06d380c2015-05-13 14:05:30 -0400201# A shorter title for the navigation bar. Default is the same as html_title.
202#html_short_title = None
203
204# The name of an image file (relative to this directory) to place at the top
205# of the sidebar.
David B. Kinderf3f266e2018-07-31 13:47:10 -0700206html_logo = 'images/Zephyr-Kite-logo.png'
Anas Nashif06d380c2015-05-13 14:05:30 -0400207
208# The name of an image file (within the static path) to use as favicon of the
209# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
210# pixels large.
David B. Kinderd47bd0b2018-07-26 13:30:42 -0700211html_favicon = 'images/zp_favicon.png'
Anas Nashif06d380c2015-05-13 14:05:30 -0400212
213# Add any paths that contain custom static files (such as style sheets) here,
214# relative to this directory. They are copied after the builtin static files,
215# so a file named "default.css" will overwrite the builtin "default.css".
Carles Cufie182dbc2018-07-16 19:05:05 +0200216html_static_path = ['{}/doc/static'.format(ZEPHYR_BASE)]
Anas Nashif06d380c2015-05-13 14:05:30 -0400217
218# Add any extra paths that contain custom files (such as robots.txt or
219# .htaccess) here, relative to this directory. These files are copied
220# directly to the root of the documentation.
221#html_extra_path = []
222
223# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
224# using the given strftime format.
Anas Nashif5d91c932015-05-28 07:43:26 -0400225html_last_updated_fmt = '%b %d, %Y'
Anas Nashif06d380c2015-05-13 14:05:30 -0400226
227# If true, SmartyPants will be used to convert quotes and dashes to
228# typographically correct entities.
Carol Lee1aa77332015-08-07 13:22:27 -0400229#html_use_smartypants =
Anas Nashif06d380c2015-05-13 14:05:30 -0400230
231# Custom sidebar templates, maps document names to template names.
232#html_sidebars = {}
233
234# Additional templates that should be rendered to pages, maps page names to
235# template names.
236#html_additional_pages = {}
237
238# If false, no module index is generated.
Carol Lee1aa77332015-08-07 13:22:27 -0400239html_domain_indices = False
Anas Nashif06d380c2015-05-13 14:05:30 -0400240
241# If false, no index is generated.
Carol Lee1aa77332015-08-07 13:22:27 -0400242html_use_index = True
Anas Nashif06d380c2015-05-13 14:05:30 -0400243
244# If true, the index is split into individual pages for each letter.
Carol Lee1aa77332015-08-07 13:22:27 -0400245html_split_index = True
Anas Nashif06d380c2015-05-13 14:05:30 -0400246
247# If true, links to the reST sources are added to the pages.
David B. Kinderf3f266e2018-07-31 13:47:10 -0700248html_show_sourcelink = False
Anas Nashif06d380c2015-05-13 14:05:30 -0400249
250# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
Rodrigo Caballero8d7b52f2015-10-16 09:30:15 -0500251html_show_sphinx = False
Anas Nashif06d380c2015-05-13 14:05:30 -0400252
253# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
David B. Kinder531f8ed2018-09-10 12:32:52 -0700254# html_show_copyright = tags.has('development')
Anas Nashif06d380c2015-05-13 14:05:30 -0400255
Rodrigo Caballero8d7b52f2015-10-16 09:30:15 -0500256# If true, license is shown in the HTML footer. Default is True.
257html_show_license = True
258
Anas Nashif06d380c2015-05-13 14:05:30 -0400259# If true, an OpenSearch description file will be output, and all pages will
260# contain a <link> tag referring to it. The value of this option must be the
261# base URL from which the finished HTML is served.
262#html_use_opensearch = ''
263
264# This is the file name suffix for HTML files (e.g. ".xhtml").
265#html_file_suffix = None
266
267# Language to be used for generating the HTML full-text search index.
268# Sphinx supports the following languages:
269# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
270# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
271#html_search_language = 'en'
272
David B. Kinder8875a982017-08-22 12:29:10 -0700273sourcelink_suffix = '.txt'
274
Anas Nashif06d380c2015-05-13 14:05:30 -0400275# A dictionary with options for the search language support, empty by default.
276# Now only 'ja' uses this config value
277#html_search_options = {'type': 'default'}
278
279# The name of a javascript file (relative to the configuration directory) that
280# implements a search results scorer. If empty, the default will be used.
281#html_search_scorer = 'scorer.js'
282
283# Output file base name for HTML help builder.
Anas Nashif089a10b2015-06-12 10:51:09 -0700284htmlhelp_basename = 'zephyrdoc'
Anas Nashif06d380c2015-05-13 14:05:30 -0400285
Anas Nashif38a77792019-01-20 08:56:48 -0500286
287# Custom added feature to allow redirecting old URLs
288#
289# list of tuples (old_url, new_url) for pages to redirect
290# (URLs should be relative to document root, only)
Anas Nashif2b9458c2019-02-03 17:29:46 -0500291html_redirect_pages = [
292 ('contribute/contribute_guidelines', 'contribute/index'),
293 ('application/application', 'application/index.rst'),
294 ('security/security', 'security/index'),
295 ('boards/boards', 'boards/index'),
296 ('samples/samples', 'samples/index'),
297 ('releases/release-notes', 'releases/index'),
298 ('getting_started/getting_starting', 'getting_started/index'),
299 ('introduction/introducing_zephyr', 'introduction/index'),
300 ('api/index', 'reference/index'),
301 ('api/api', 'reference/index'),
302 ('subsystems/subsystems', 'reference/index'),
303 ('kernel/kernel', 'reference/kernel/index'),
304
305 ]
Anas Nashif38a77792019-01-20 08:56:48 -0500306
Anas Nashif06d380c2015-05-13 14:05:30 -0400307# -- Options for LaTeX output ---------------------------------------------
308
309latex_elements = {
310# The paper size ('letterpaper' or 'a4paper').
311#'papersize': 'letterpaper',
312
313# The font size ('10pt', '11pt' or '12pt').
314#'pointsize': '10pt',
315
316# Additional stuff for the LaTeX preamble.
Daniel Leung9945e7f2018-08-23 11:11:11 -0700317'preamble': '\setcounter{tocdepth}{2}',
Anas Nashif06d380c2015-05-13 14:05:30 -0400318
319# Latex figure (float) alignment
320#'figure_align': 'htbp',
321}
322
323# Grouping the document tree into LaTeX files. List of tuples
324# (source start file, target name, title,
325# author, documentclass [howto, manual, or own class]).
326latex_documents = [
Anas Nashif089a10b2015-06-12 10:51:09 -0700327 (master_doc, 'zephyr.tex', u'Zephyr Project Documentation',
Anas Nashif06d380c2015-05-13 14:05:30 -0400328 u'many', 'manual'),
329]
330
331# The name of an image file (relative to this directory) to place at the top of
332# the title page.
333#latex_logo = None
334
335# For "manual" documents, if this is true, then toplevel headings are parts,
336# not chapters.
337#latex_use_parts = False
338
339# If true, show page references after internal links.
340#latex_show_pagerefs = False
341
342# If true, show URL addresses after external links.
343#latex_show_urls = False
344
345# Documents to append as an appendix to all manuals.
346#latex_appendices = []
347
348# If false, no module index is generated.
349#latex_domain_indices = True
350
Anas Nashif06d380c2015-05-13 14:05:30 -0400351# -- Options for manual page output ---------------------------------------
352
353# One entry per manual page. List of tuples
354# (source start file, name, description, authors, manual section).
355man_pages = [
Anas Nashif089a10b2015-06-12 10:51:09 -0700356 (master_doc, 'zephyr', u'Zephyr Project Documentation',
Anas Nashif06d380c2015-05-13 14:05:30 -0400357 [author], 1)
358]
359
360# If true, show URL addresses after external links.
361#man_show_urls = False
362
363
364# -- Options for Texinfo output -------------------------------------------
365
366# Grouping the document tree into Texinfo files. List of tuples
367# (source start file, target name, title, author,
368# dir menu entry, description, category)
369texinfo_documents = [
Anas Nashif089a10b2015-06-12 10:51:09 -0700370 (master_doc, 'zephyr', u'Zephyr Project Documentation',
371 author, 'Zephyr', 'One line description of project.',
Anas Nashif06d380c2015-05-13 14:05:30 -0400372 'Miscellaneous'),
373]
374
375# Documents to append as an appendix to all manuals.
376#texinfo_appendices = []
377
378# If false, no module index is generated.
379#texinfo_domain_indices = True
380
381# How to display URL addresses: 'footnote', 'no', or 'inline'.
382#texinfo_show_urls = 'footnote'
383
384# If true, do not generate a @detailmenu in the "Top" node's menu.
385#texinfo_no_detailmenu = False
386
Rodrigo Caballeroc394b342015-05-15 11:35:25 -0500387breathe_projects = {
Carles Cufie182dbc2018-07-16 19:05:05 +0200388 "Zephyr": "{}/doxygen/xml".format(ZEPHYR_BUILD),
389 "doc-examples": "{}/doxygen/xml".format(ZEPHYR_BUILD)
Anas Nashif06d380c2015-05-13 14:05:30 -0400390}
Anas Nashif089a10b2015-06-12 10:51:09 -0700391breathe_default_project = "Zephyr"
Rodrigo Caballero8d7b52f2015-10-16 09:30:15 -0500392
David B. Kinder3d4f2132017-09-29 11:31:46 -0700393# Qualifiers to a function are causing Sphihx/Breathe to warn about
394# Error when parsing function declaration and more. This is a list
395# of strings that the parser additionally should accept as
396# attributes.
David B. Kinderde85fde2017-09-29 15:34:48 -0700397cpp_id_attributes = ['__syscall', '__syscall_inline', '__deprecated',
398 '__may_alias', '__used', '__unused', '__weak',
399 '__DEPRECATED_MACRO', 'FUNC_NORETURN' ]
David B. Kinder3d4f2132017-09-29 11:31:46 -0700400
David B. Kinder11baf5c2017-05-18 12:34:46 -0700401# docs_title is used in the breadcrumb title in the zephyr docs theme
Rodrigo Caballero8d7b52f2015-10-16 09:30:15 -0500402html_context = {
403 'show_license': html_show_license,
Anas Nashif3ba693f2017-05-19 08:36:20 -0400404 'docs_title': docs_title,
Anas Nashifb53d6972017-11-17 19:02:11 -0500405 'is_release': is_release,
David B. Kinderf3f266e2018-07-31 13:47:10 -0700406 'theme_logo_only': False,
David B. Kinderd47bd0b2018-07-26 13:30:42 -0700407 'current_version': version,
408 'versions': ( ("latest", "/"),
David B. Kinder23d4c5d2018-09-06 17:51:52 -0700409 ("1.13.0", "/1.13.0/"),
David B. Kinderd47bd0b2018-07-26 13:30:42 -0700410 ("1.12.0", "/1.12.0/"),
411 ("1.11.0", "/1.11.0/"),
412 ("1.10.0", "/1.10.0/"),
413 ("1.9.2", "/1.9.0/"),
414 )
Rodrigo Caballero8d7b52f2015-10-16 09:30:15 -0500415}
Anas Nashifb7b23182017-01-03 14:43:02 -0500416
Anas Nashif38a77792019-01-20 08:56:48 -0500417
David B. Kinder3d4f2132017-09-29 11:31:46 -0700418extlinks = {'jira': ('https://jira.zephyrproject.org/browse/%s', ''),
419 'github': ('https://github.com/zephyrproject-rtos/zephyr/issues/%s', '')
420 }
David B. Kinder6bd5dff2017-01-27 16:20:21 -0800421
David B. Kinder2a1adfc2017-04-27 14:59:04 -0700422# some configuration for linkcheck builder
423# noticed that we're getting false-positive link errors on JIRA, I suspect
424# because it's taking too long for the server to respond so bump up the
425# timeout (default=5) and turn off anchor checks (so only a HEAD request is
426# done - much faster) Leave the ignore commented in case we want to remove
427# jira link checks later...
428
429linkcheck_timeout = 30
430linkcheck_workers = 10
431# linkcheck_ignore = [r'https://jira\.zephyrproject\.org/']
432linkcheck_anchors = False
433
David B. Kinder6bd5dff2017-01-27 16:20:21 -0800434def setup(app):
435 app.add_stylesheet("zephyr-custom.css")
David B. Kinderf3f266e2018-07-31 13:47:10 -0700436 app.add_javascript("zephyr-custom.js")