]> granicus.if.org Git - esp-idf/blob - docs/conf_common.py
Merge branch 'feature/btdm_controller_to_host_flow_control' into 'master'
[esp-idf] / docs / conf_common.py
1 # -*- coding: utf-8 -*-
2 #
3 # Common (non-language-specific) configuration for Read The Docs & Sphinx
4 #
5 # Based on a Read the Docs Template documentation build configuration file,
6 # created by sphinx-quickstart on Tue Aug 26 14:19:49 2014.
7 #
8 # This file is imported from a language-specific conf.py (ie en/conf.py or
9 # zh_CN/conf.py)
10 #
11 # Note that not all possible configuration values are present in this
12 # autogenerated file.
13 #
14 # All configuration values have a default; values that are commented out
15 # serve to show the default.
16
17 import sys, os
18 import re
19 from subprocess import Popen, PIPE
20 import shlex
21
22 # Note: If extensions (or modules to document with autodoc) are in another directory,
23 # add these directories to sys.path here. If the directory is relative to the
24 # documentation root, use os.path.abspath to make it absolute
25
26 from local_util import run_cmd_get_output, copy_if_modified
27
28 builddir = '_build'
29 builddir = builddir
30 if 'BUILDDIR' in os.environ:
31     builddir = os.environ['BUILDDIR']
32
33 # Call Doxygen to get XML files from the header files
34 print("Calling Doxygen to generate latest XML files")
35 if os.system("doxygen ../Doxyfile") != 0:
36     raise RuntimeError('Doxygen call failed')
37
38 # Doxygen has generated XML files in 'xml' directory.
39 # Copy them to 'xml_in', only touching the files which have changed.
40 copy_if_modified('xml/', 'xml_in/')
41
42 # Generate 'api_name.inc' files using the XML files by Doxygen
43 if os.system('python ../gen-dxd.py') != 0:
44     raise RuntimeError('gen-dxd.py failed')
45
46 # Generate 'kconfig.inc' file from components' Kconfig files
47 kconfig_inc_path = '{}/inc/kconfig.inc'.format(builddir)
48 if os.system('python ../gen-kconfig-doc.py > ' + kconfig_inc_path + '.in') != 0:
49     raise RuntimeError('gen-kconfig-doc.py failed')
50
51 copy_if_modified(kconfig_inc_path + '.in', kconfig_inc_path)
52
53 # Generate 'esp_err_defs.inc' file with ESP_ERR_ error code definitions
54 esp_err_inc_path = '{}/inc/esp_err_defs.inc'.format(builddir)
55 if os.system('python ../../tools/gen_esp_err_to_name.py --rst_output ' + esp_err_inc_path + '.in') != 0:
56     raise RuntimeError('gen_esp_err_to_name.py failed')
57 copy_if_modified(esp_err_inc_path + '.in', esp_err_inc_path)
58
59 # http://stackoverflow.com/questions/12772927/specifying-an-online-image-in-sphinx-restructuredtext-format
60
61 suppress_warnings = ['image.nonlocal_uri']
62
63 # -- General configuration ------------------------------------------------
64
65 # If your documentation needs a minimal Sphinx version, state it here.
66 #needs_sphinx = '1.0'
67
68 # Add any Sphinx extension module names here, as strings. They can be
69 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
70 # ones.
71 extensions = ['breathe',
72                    'link-roles',
73                    'sphinxcontrib.blockdiag',
74                    'sphinxcontrib.seqdiag',
75                    'sphinxcontrib.actdiag',
76                    'sphinxcontrib.nwdiag',
77                    'sphinxcontrib.rackdiag',
78                    'sphinxcontrib.packetdiag'
79                   ]
80
81 # Set up font for blockdiag, nwdiag, rackdiag and packetdiag
82 blockdiag_fontpath = '../_static/DejaVuSans.ttf'
83 seqdiag_fontpath = '../_static/DejaVuSans.ttf'
84 actdiag_fontpath = '../_static/DejaVuSans.ttf'
85 nwdiag_fontpath = '../_static/DejaVuSans.ttf'
86 rackdiag_fontpath = '../_static/DejaVuSans.ttf'
87 packetdiag_fontpath = '../_static/DejaVuSans.ttf'
88
89 # Breathe extension variables
90
91 # Doxygen regenerates files in 'xml/' directory every time,
92 # but we copy files to 'xml_in/' only when they change, to speed up
93 # incremental builds.
94 breathe_projects = { "esp32-idf": "xml_in/" }
95 breathe_default_project = "esp32-idf"
96
97 # Add any paths that contain templates here, relative to this directory.
98 templates_path = ['_templates']
99
100 # The suffix of source filenames.
101 source_suffix = ['.rst', '.md']
102
103 source_parsers = {
104        '.md': 'recommonmark.parser.CommonMarkParser',
105     }
106
107 # The encoding of source files.
108 #source_encoding = 'utf-8-sig'
109
110 # The master toctree document.
111 master_doc = 'index'
112
113
114 # The version info for the project you're documenting, acts as replacement for
115 # |version| and |release|, also used in various other places throughout the
116 # built documents.
117 #
118
119 # Readthedocs largely ignores 'version' and 'release', and displays one of
120 # 'latest', tag name, or branch name, depending on the build type.
121 # Still, this is useful for non-RTD builds.
122 # This is supposed to be "the short X.Y version", but it's the only version
123 # visible when you open index.html.
124 # Display full version to make things less confusing.
125 version = run_cmd_get_output('git describe')
126 # The full version, including alpha/beta/rc tags.
127 # If needed, nearest tag is returned by 'git describe --abbrev=0'.
128 release = version
129 print('Version: {0}  Release: {1}'.format(version, release))
130
131 # There are two options for replacing |today|: either, you set today to some
132 # non-false value, then it is used:
133 #today = ''
134 # Else, today_fmt is used as the format for a strftime call.
135 #today_fmt = '%B %d, %Y'
136
137 # List of patterns, relative to source directory, that match files and
138 # directories to ignore when looking for source files.
139 exclude_patterns = ['_build','README.md']
140
141 # The reST default role (used for this markup: `text`) to use for all
142 # documents.
143 #default_role = None
144
145 # If true, '()' will be appended to :func: etc. cross-reference text.
146 #add_function_parentheses = True
147
148 # If true, the current module name will be prepended to all description
149 # unit titles (such as .. function::).
150 #add_module_names = True
151
152 # If true, sectionauthor and moduleauthor directives will be shown in the
153 # output. They are ignored by default.
154 #show_authors = False
155
156 # The name of the Pygments (syntax highlighting) style to use.
157 pygments_style = 'sphinx'
158
159 # A list of ignored prefixes for module index sorting.
160 #modindex_common_prefix = []
161
162 # If true, keep warnings as "system message" paragraphs in the built documents.
163 #keep_warnings = False
164
165
166 # -- Options for HTML output ----------------------------------------------
167
168 # The theme to use for HTML and HTML Help pages.  See the documentation for
169 # a list of builtin themes.
170 html_theme = 'default'
171
172 # Theme options are theme-specific and customize the look and feel of a theme
173 # further.  For a list of options available for each theme, see the
174 # documentation.
175 #html_theme_options = {}
176
177 # Add any paths that contain custom themes here, relative to this directory.
178 #html_theme_path = []
179
180 # The name for this set of Sphinx documents.  If None, it defaults to
181 # "<project> v<release> documentation".
182 #html_title = None
183
184 # A shorter title for the navigation bar.  Default is the same as html_title.
185 #html_short_title = None
186
187 # The name of an image file (relative to this directory) to place at the top
188 # of the sidebar.
189 #html_logo = None
190
191 # The name of an image file (within the static path) to use as favicon of the
192 # docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
193 # pixels large.
194 #html_favicon = None
195
196 # Add any paths that contain custom static files (such as style sheets) here,
197 # relative to this directory. They are copied after the builtin static files,
198 # so a file named "default.css" will overwrite the builtin "default.css".
199 html_static_path = ['../_static']
200
201 # Add any extra paths that contain custom files (such as robots.txt or
202 # .htaccess) here, relative to this directory. These files are copied
203 # directly to the root of the documentation.
204 #html_extra_path = []
205
206 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
207 # using the given strftime format.
208 #html_last_updated_fmt = '%b %d, %Y'
209
210 # If true, SmartyPants will be used to convert quotes and dashes to
211 # typographically correct entities.
212 #html_use_smartypants = True
213
214 # Custom sidebar templates, maps document names to template names.
215 #html_sidebars = {}
216
217 # Additional templates that should be rendered to pages, maps page names to
218 # template names.
219 #html_additional_pages = {}
220
221 # If false, no module index is generated.
222 #html_domain_indices = True
223
224 # If false, no index is generated.
225 #html_use_index = True
226
227 # If true, the index is split into individual pages for each letter.
228 #html_split_index = False
229
230 # If true, links to the reST sources are added to the pages.
231 #html_show_sourcelink = True
232
233 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
234 #html_show_sphinx = True
235
236 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
237 #html_show_copyright = True
238
239 # If true, an OpenSearch description file will be output, and all pages will
240 # contain a <link> tag referring to it.  The value of this option must be the
241 # base URL from which the finished HTML is served.
242 #html_use_opensearch = ''
243
244 # This is the file name suffix for HTML files (e.g. ".xhtml").
245 #html_file_suffix = None
246
247 # Output file base name for HTML help builder.
248 htmlhelp_basename = 'ReadtheDocsTemplatedoc'
249
250
251 # -- Options for LaTeX output ---------------------------------------------
252
253 latex_elements = {
254 # The paper size ('letterpaper' or 'a4paper').
255 #'papersize': 'letterpaper',
256
257 # The font size ('10pt', '11pt' or '12pt').
258 #'pointsize': '10pt',
259
260 # Additional stuff for the LaTeX preamble.
261 #'preamble': '',
262 }
263
264 # Grouping the document tree into LaTeX files. List of tuples
265 # (source start file, target name, title,
266 #  author, documentclass [howto, manual, or own class]).
267 latex_documents = [
268   ('index', 'ReadtheDocsTemplate.tex', u'Read the Docs Template Documentation',
269    u'Read the Docs', 'manual'),
270 ]
271
272 # The name of an image file (relative to this directory) to place at the top of
273 # the title page.
274 #latex_logo = None
275
276 # For "manual" documents, if this is true, then toplevel headings are parts,
277 # not chapters.
278 #latex_use_parts = False
279
280 # If true, show page references after internal links.
281 #latex_show_pagerefs = False
282
283 # If true, show URL addresses after external links.
284 #latex_show_urls = False
285
286 # Documents to append as an appendix to all manuals.
287 #latex_appendices = []
288
289 # If false, no module index is generated.
290 #latex_domain_indices = True
291
292
293 # -- Options for manual page output ---------------------------------------
294
295 # One entry per manual page. List of tuples
296 # (source start file, name, description, authors, manual section).
297 man_pages = [
298     ('index', 'readthedocstemplate', u'Read the Docs Template Documentation',
299      [u'Read the Docs'], 1)
300 ]
301
302 # If true, show URL addresses after external links.
303 #man_show_urls = False
304
305
306 # -- Options for Texinfo output -------------------------------------------
307
308 # Grouping the document tree into Texinfo files. List of tuples
309 # (source start file, target name, title, author,
310 #  dir menu entry, description, category)
311 texinfo_documents = [
312   ('index', 'ReadtheDocsTemplate', u'Read the Docs Template Documentation',
313    u'Read the Docs', 'ReadtheDocsTemplate', 'One line description of project.',
314    'Miscellaneous'),
315 ]
316
317 # Documents to append as an appendix to all manuals.
318 #texinfo_appendices = []
319
320 # If false, no module index is generated.
321 #texinfo_domain_indices = True
322
323 # How to display URL addresses: 'footnote', 'no', or 'inline'.
324 #texinfo_show_urls = 'footnote'
325
326 # If true, do not generate a @detailmenu in the "Top" node's menu.
327 #texinfo_no_detailmenu = False
328
329 # -- Use sphinx_rtd_theme for local builds --------------------------------
330 # ref. https://github.com/snide/sphinx_rtd_theme#using-this-theme-locally-then-building-on-read-the-docs
331 #
332 # on_rtd is whether we are on readthedocs.org
333 on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
334
335 if not on_rtd:  # only import and set the theme if we're building docs locally
336     import sphinx_rtd_theme
337     html_theme = 'sphinx_rtd_theme'
338     html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
339
340 # otherwise, readthedocs.org uses their theme by default, so no need to specify it
341
342 # Override RTD CSS theme to introduce the theme corrections
343 # https://github.com/rtfd/sphinx_rtd_theme/pull/432
344 def setup(app):
345     app.add_stylesheet('theme_overrides.css')