blob: cb1cfd3df82a013e2f14a24d8d3a43dc0ff62101 [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
Anas Nashif06d380c2015-05-13 14:05:30 -040017
Marti Bolivar1c852dd2018-06-07 21:45:55 -040018if "ZEPHYR_BASE" not in os.environ:
Marti Bolivarf8251692018-06-08 09:54:22 -040019 sys.exit("$ZEPHYR_BASE environment variable undefined.")
Marti Bolivar1c852dd2018-06-07 21:45:55 -040020ZEPHYR_BASE = os.environ["ZEPHYR_BASE"]
21
Marti Bolivar6092fb02017-11-03 16:46:33 -040022# Add the 'extensions' directory to sys.path, to enable finding Sphinx
23# extensions within.
24sys.path.insert(0, os.path.join(os.path.abspath('.'), 'extensions'))
Marti Bolivar1c852dd2018-06-07 21:45:55 -040025# Also add west, to be able to pull in its API docs.
26sys.path.append(os.path.abspath(os.path.join(ZEPHYR_BASE, 'scripts', 'meta')))
Anas Nashif06d380c2015-05-13 14:05:30 -040027
28# -- General configuration ------------------------------------------------
29
30# If your documentation needs a minimal Sphinx version, state it here.
31#needs_sphinx = '1.0'
32
33# Add any Sphinx extension module names here, as strings. They can be
34# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
35# ones.
36extensions = [
David B. Kinder05e00f62018-02-22 10:09:52 -080037 'breathe', 'sphinx.ext.todo',
Marti Bolivar6092fb02017-11-03 16:46:33 -040038 'sphinx.ext.extlinks',
Marti Bolivar3a766ae2018-06-07 22:07:00 -040039 'sphinx.ext.autodoc',
Marti Bolivar6092fb02017-11-03 16:46:33 -040040 'zephyr.application',
Anas Nashif06d380c2015-05-13 14:05:30 -040041]
42
43# Add any paths that contain templates here, relative to this directory.
44templates_path = ['_templates']
45
46# The suffix(es) of source filenames.
47# You can specify multiple suffix as a list of string:
48# source_suffix = ['.rst', '.md']
49source_suffix = '.rst'
50
51# The encoding of source files.
52#source_encoding = 'utf-8-sig'
53
54# The master toctree document.
55master_doc = 'index'
56
57# General information about the project.
Anas Nashif089a10b2015-06-12 10:51:09 -070058project = u'Zephyr Project'
Anas Nashif2131d172017-01-26 09:30:46 -050059copyright = u'2015-2017 Zephyr Project members and individual contributors.'
Anas Nashif06d380c2015-05-13 14:05:30 -040060author = u'many'
61
Anas Nashif762bd852016-12-23 12:25:06 -050062# The following code tries to extract the information by reading the Makefile,
63# when Sphinx is run directly (e.g. by Read the Docs).
64try:
Anas Nashifcb9390c2017-11-19 23:03:58 -050065 version_major = None
66 version_minor = None
67 patchlevel = None
68 extraversion = None
Anas Nashif75141782017-12-09 11:20:44 -050069 for line in open(os.path.join(ZEPHYR_BASE, 'VERSION')):
Anas Nashif762bd852016-12-23 12:25:06 -050070 key, val = [x.strip() for x in line.split('=', 2)]
71 if key == 'VERSION_MAJOR':
Anas Nashifcb9390c2017-11-19 23:03:58 -050072 version_major = val
Anas Nashif762bd852016-12-23 12:25:06 -050073 if key == 'VERSION_MINOR':
Anas Nashifcb9390c2017-11-19 23:03:58 -050074 version_minor = val
Anas Nashif762bd852016-12-23 12:25:06 -050075 elif key == 'PATCHLEVEL':
Anas Nashifcb9390c2017-11-19 23:03:58 -050076 patchlevel = val
77 elif key == 'EXTRAVERSION':
78 extraversion = val
79 if version_major and version_minor and patchlevel and extraversion:
Anas Nashif762bd852016-12-23 12:25:06 -050080 break
81except:
82 pass
83finally:
Anas Nashif75141782017-12-09 11:20:44 -050084 if version_major and version_minor and patchlevel and extraversion is not None :
Anas Nashifcb9390c2017-11-19 23:03:58 -050085 version = release = version_major + '.' + version_minor + '.' + patchlevel
86 if extraversion != '':
87 version = release = version + '-' + extraversion
Anas Nashif762bd852016-12-23 12:25:06 -050088 else:
89 sys.stderr.write('Warning: Could not extract kernel version\n')
90 version = release = "unknown version"
Anas Nashifa037c362017-11-07 20:02:24 -050091 version = release = os.getenv('KERNELVERSION','1.9.0')
Anas Nashif06d380c2015-05-13 14:05:30 -040092
93# The language for content autogenerated by Sphinx. Refer to documentation
94# for a list of supported languages.
95#
96# This is also used if you do content translation via gettext catalogs.
97# Usually you set "language" from the command line for these cases.
98language = None
99
100# There are two options for replacing |today|: either, you set today to some
101# non-false value, then it is used:
102#today = ''
103# Else, today_fmt is used as the format for a strftime call.
104#today_fmt = '%B %d, %Y'
105
106# List of patterns, relative to source directory, that match files and
107# directories to ignore when looking for source files.
108exclude_patterns = ['_build']
109
110# The reST default role (used for this markup: `text`) to use for all
111# documents.
112#default_role = None
113
114# If true, '()' will be appended to :func: etc. cross-reference text.
115#add_function_parentheses = True
116
117# If true, the current module name will be prepended to all description
118# unit titles (such as .. function::).
119#add_module_names = True
120
121# If true, sectionauthor and moduleauthor directives will be shown in the
122# output. They are ignored by default.
123#show_authors = False
124
125# The name of the Pygments (syntax highlighting) style to use.
126pygments_style = 'sphinx'
127
Bobby Noeltea5a29e42018-02-08 10:48:01 +0100128# Additional lexer for Pygments (syntax highlighting)
129from lexer.DtsLexer import DtsLexer
130from sphinx.highlighting import lexers
131lexers['DTS'] = DtsLexer()
132
Anas Nashif06d380c2015-05-13 14:05:30 -0400133# A list of ignored prefixes for module index sorting.
134#modindex_common_prefix = []
135
136# If true, keep warnings as "system message" paragraphs in the built documents.
137#keep_warnings = False
138
139# If true, `todo` and `todoList` produce output, else they produce nothing.
Carol Lee1aa77332015-08-07 13:22:27 -0400140todo_include_todos = False
Anas Nashif089a10b2015-06-12 10:51:09 -0700141
142rst_epilog = """
David B. Kinder486c5a52018-05-04 16:31:05 -0700143.. include:: /substitutions.txt
Anas Nashif089a10b2015-06-12 10:51:09 -0700144"""
Anas Nashif06d380c2015-05-13 14:05:30 -0400145
Anas Nashif06d380c2015-05-13 14:05:30 -0400146# -- Options for HTML output ----------------------------------------------
147
Anas Nashif9f52ee62016-12-23 12:27:57 -0500148try:
149 import sphinx_rtd_theme
150except ImportError:
151 html_theme = 'zephyr'
152 html_theme_path = ['./themes']
153else:
154 html_theme = "sphinx_rtd_theme"
155 html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
Anas Nashif06d380c2015-05-13 14:05:30 -0400156
Anas Nashif457ae382017-01-04 09:39:45 -0500157if tags.has('daily') or tags.has('release'):
158 html_theme = 'zephyr-docs-theme'
159 html_theme_path = ['./themes']
160
161
Anas Nashif3ba693f2017-05-19 08:36:20 -0400162if tags.has('release'):
Anas Nashifb53d6972017-11-17 19:02:11 -0500163 is_release = True
Anas Nashif3ba693f2017-05-19 08:36:20 -0400164 docs_title = 'Docs / %s' %(version)
165else:
Anas Nashifb53d6972017-11-17 19:02:11 -0500166 is_release = False
David B. Kinder5229f872018-03-02 14:01:52 -0800167 docs_title = 'Docs / Latest'
Anas Nashif3ba693f2017-05-19 08:36:20 -0400168
Anas Nashif06d380c2015-05-13 14:05:30 -0400169# The name for this set of Sphinx documents. If None, it defaults to
170# "<project> v<release> documentation".
Anas Nashif12867502015-06-29 15:33:28 -0400171html_title = "Zephyr Project Documentation"
Anas Nashif06d380c2015-05-13 14:05:30 -0400172
Yannis Damigosab1c6a12016-03-02 10:38:49 +0200173# This value determines the text for the permalink; it defaults to "¶".
174# Set it to None or the empty string to disable permalinks.
David B. Kinder4031da82017-02-06 09:51:15 -0800175#html_add_permalinks = ""
Rodrigo Caballero8d7b52f2015-10-16 09:30:15 -0500176
Anas Nashif06d380c2015-05-13 14:05:30 -0400177# A shorter title for the navigation bar. Default is the same as html_title.
178#html_short_title = None
179
180# The name of an image file (relative to this directory) to place at the top
181# of the sidebar.
182#html_logo = None
183
184# The name of an image file (within the static path) to use as favicon of the
185# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
186# pixels large.
187#html_favicon = None
188
189# Add any paths that contain custom static files (such as style sheets) here,
190# relative to this directory. They are copied after the builtin static files,
191# so a file named "default.css" will overwrite the builtin "default.css".
David B. Kinder6bd5dff2017-01-27 16:20:21 -0800192html_static_path = ['static']
Anas Nashif06d380c2015-05-13 14:05:30 -0400193
194# Add any extra paths that contain custom files (such as robots.txt or
195# .htaccess) here, relative to this directory. These files are copied
196# directly to the root of the documentation.
197#html_extra_path = []
198
199# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
200# using the given strftime format.
Anas Nashif5d91c932015-05-28 07:43:26 -0400201html_last_updated_fmt = '%b %d, %Y'
Anas Nashif06d380c2015-05-13 14:05:30 -0400202
203# If true, SmartyPants will be used to convert quotes and dashes to
204# typographically correct entities.
Carol Lee1aa77332015-08-07 13:22:27 -0400205#html_use_smartypants =
Anas Nashif06d380c2015-05-13 14:05:30 -0400206
207# Custom sidebar templates, maps document names to template names.
208#html_sidebars = {}
209
210# Additional templates that should be rendered to pages, maps page names to
211# template names.
212#html_additional_pages = {}
213
214# If false, no module index is generated.
Carol Lee1aa77332015-08-07 13:22:27 -0400215html_domain_indices = False
Anas Nashif06d380c2015-05-13 14:05:30 -0400216
217# If false, no index is generated.
Carol Lee1aa77332015-08-07 13:22:27 -0400218html_use_index = True
Anas Nashif06d380c2015-05-13 14:05:30 -0400219
220# If true, the index is split into individual pages for each letter.
Carol Lee1aa77332015-08-07 13:22:27 -0400221html_split_index = True
Anas Nashif06d380c2015-05-13 14:05:30 -0400222
223# If true, links to the reST sources are added to the pages.
Carol Lee1aa77332015-08-07 13:22:27 -0400224#html_show_sourcelink =
Anas Nashif06d380c2015-05-13 14:05:30 -0400225
226# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
Rodrigo Caballero8d7b52f2015-10-16 09:30:15 -0500227html_show_sphinx = False
Anas Nashif06d380c2015-05-13 14:05:30 -0400228
229# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
Anas Nashif457ae382017-01-04 09:39:45 -0500230html_show_copyright = tags.has('development')
Anas Nashif06d380c2015-05-13 14:05:30 -0400231
Rodrigo Caballero8d7b52f2015-10-16 09:30:15 -0500232# If true, license is shown in the HTML footer. Default is True.
233html_show_license = True
234
Anas Nashif06d380c2015-05-13 14:05:30 -0400235# If true, an OpenSearch description file will be output, and all pages will
236# contain a <link> tag referring to it. The value of this option must be the
237# base URL from which the finished HTML is served.
238#html_use_opensearch = ''
239
240# This is the file name suffix for HTML files (e.g. ".xhtml").
241#html_file_suffix = None
242
243# Language to be used for generating the HTML full-text search index.
244# Sphinx supports the following languages:
245# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
246# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
247#html_search_language = 'en'
248
David B. Kinder8875a982017-08-22 12:29:10 -0700249sourcelink_suffix = '.txt'
250
Anas Nashif06d380c2015-05-13 14:05:30 -0400251# A dictionary with options for the search language support, empty by default.
252# Now only 'ja' uses this config value
253#html_search_options = {'type': 'default'}
254
255# The name of a javascript file (relative to the configuration directory) that
256# implements a search results scorer. If empty, the default will be used.
257#html_search_scorer = 'scorer.js'
258
259# Output file base name for HTML help builder.
Anas Nashif089a10b2015-06-12 10:51:09 -0700260htmlhelp_basename = 'zephyrdoc'
Anas Nashif06d380c2015-05-13 14:05:30 -0400261
262# -- Options for LaTeX output ---------------------------------------------
263
264latex_elements = {
265# The paper size ('letterpaper' or 'a4paper').
266#'papersize': 'letterpaper',
267
268# The font size ('10pt', '11pt' or '12pt').
269#'pointsize': '10pt',
270
271# Additional stuff for the LaTeX preamble.
272#'preamble': '',
273
274# Latex figure (float) alignment
275#'figure_align': 'htbp',
276}
277
278# Grouping the document tree into LaTeX files. List of tuples
279# (source start file, target name, title,
280# author, documentclass [howto, manual, or own class]).
281latex_documents = [
Anas Nashif089a10b2015-06-12 10:51:09 -0700282 (master_doc, 'zephyr.tex', u'Zephyr Project Documentation',
Anas Nashif06d380c2015-05-13 14:05:30 -0400283 u'many', 'manual'),
284]
285
286# The name of an image file (relative to this directory) to place at the top of
287# the title page.
288#latex_logo = None
289
290# For "manual" documents, if this is true, then toplevel headings are parts,
291# not chapters.
292#latex_use_parts = False
293
294# If true, show page references after internal links.
295#latex_show_pagerefs = False
296
297# If true, show URL addresses after external links.
298#latex_show_urls = False
299
300# Documents to append as an appendix to all manuals.
301#latex_appendices = []
302
303# If false, no module index is generated.
304#latex_domain_indices = True
305
306
307# -- Options for manual page output ---------------------------------------
308
309# One entry per manual page. List of tuples
310# (source start file, name, description, authors, manual section).
311man_pages = [
Anas Nashif089a10b2015-06-12 10:51:09 -0700312 (master_doc, 'zephyr', u'Zephyr Project Documentation',
Anas Nashif06d380c2015-05-13 14:05:30 -0400313 [author], 1)
314]
315
316# If true, show URL addresses after external links.
317#man_show_urls = False
318
319
320# -- Options for Texinfo output -------------------------------------------
321
322# Grouping the document tree into Texinfo files. List of tuples
323# (source start file, target name, title, author,
324# dir menu entry, description, category)
325texinfo_documents = [
Anas Nashif089a10b2015-06-12 10:51:09 -0700326 (master_doc, 'zephyr', u'Zephyr Project Documentation',
327 author, 'Zephyr', 'One line description of project.',
Anas Nashif06d380c2015-05-13 14:05:30 -0400328 'Miscellaneous'),
329]
330
331# Documents to append as an appendix to all manuals.
332#texinfo_appendices = []
333
334# If false, no module index is generated.
335#texinfo_domain_indices = True
336
337# How to display URL addresses: 'footnote', 'no', or 'inline'.
338#texinfo_show_urls = 'footnote'
339
340# If true, do not generate a @detailmenu in the "Top" node's menu.
341#texinfo_no_detailmenu = False
342
Rodrigo Caballeroc394b342015-05-15 11:35:25 -0500343breathe_projects = {
Anas Nashif1fdfc5d2017-02-05 09:24:50 -0500344 "Zephyr": "doxygen/xml",
345 "doc-examples": "doxygen/xml"
Anas Nashif06d380c2015-05-13 14:05:30 -0400346}
Anas Nashif089a10b2015-06-12 10:51:09 -0700347breathe_default_project = "Zephyr"
Rodrigo Caballero8d7b52f2015-10-16 09:30:15 -0500348
David B. Kinder3d4f2132017-09-29 11:31:46 -0700349# Qualifiers to a function are causing Sphihx/Breathe to warn about
350# Error when parsing function declaration and more. This is a list
351# of strings that the parser additionally should accept as
352# attributes.
David B. Kinderde85fde2017-09-29 15:34:48 -0700353cpp_id_attributes = ['__syscall', '__syscall_inline', '__deprecated',
354 '__may_alias', '__used', '__unused', '__weak',
355 '__DEPRECATED_MACRO', 'FUNC_NORETURN' ]
David B. Kinder3d4f2132017-09-29 11:31:46 -0700356
David B. Kinder11baf5c2017-05-18 12:34:46 -0700357# docs_title is used in the breadcrumb title in the zephyr docs theme
Rodrigo Caballero8d7b52f2015-10-16 09:30:15 -0500358html_context = {
359 'show_license': html_show_license,
Anas Nashif3ba693f2017-05-19 08:36:20 -0400360 'docs_title': docs_title,
Anas Nashifb53d6972017-11-17 19:02:11 -0500361 'is_release': is_release,
Rodrigo Caballero8d7b52f2015-10-16 09:30:15 -0500362}
Anas Nashifb7b23182017-01-03 14:43:02 -0500363
David B. Kinder3d4f2132017-09-29 11:31:46 -0700364extlinks = {'jira': ('https://jira.zephyrproject.org/browse/%s', ''),
365 'github': ('https://github.com/zephyrproject-rtos/zephyr/issues/%s', '')
366 }
David B. Kinder6bd5dff2017-01-27 16:20:21 -0800367
David B. Kinder2a1adfc2017-04-27 14:59:04 -0700368# some configuration for linkcheck builder
369# noticed that we're getting false-positive link errors on JIRA, I suspect
370# because it's taking too long for the server to respond so bump up the
371# timeout (default=5) and turn off anchor checks (so only a HEAD request is
372# done - much faster) Leave the ignore commented in case we want to remove
373# jira link checks later...
374
375linkcheck_timeout = 30
376linkcheck_workers = 10
377# linkcheck_ignore = [r'https://jira\.zephyrproject\.org/']
378linkcheck_anchors = False
379
David B. Kinder6bd5dff2017-01-27 16:20:21 -0800380def setup(app):
381 app.add_stylesheet("zephyr-custom.css")