1 # -*- coding: utf-8 -*-
3 # Common (non-language-specific) configuration for Read The Docs & Sphinx
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.
8 # This file is imported from a language-specific conf.py (ie en/conf.py or
11 # Note that not all possible configuration values are present in this
14 # All configuration values have a default; values that are commented out
15 # serve to show the default.
19 from subprocess import Popen, PIPE
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
26 from local_util import run_cmd_get_output, copy_if_modified
30 if 'BUILDDIR' in os.environ:
31 builddir = os.environ['BUILDDIR']
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')
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/')
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')
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')
51 copy_if_modified(kconfig_inc_path + '.in', kconfig_inc_path)
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)
59 # http://stackoverflow.com/questions/12772927/specifying-an-online-image-in-sphinx-restructuredtext-format
61 suppress_warnings = ['image.nonlocal_uri']
63 # -- General configuration ------------------------------------------------
65 # If your documentation needs a minimal Sphinx version, state it here.
68 # Add any Sphinx extension module names here, as strings. They can be
69 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
71 extensions = ['breathe',
73 'sphinxcontrib.blockdiag',
74 'sphinxcontrib.seqdiag',
75 'sphinxcontrib.actdiag',
76 'sphinxcontrib.nwdiag',
77 'sphinxcontrib.rackdiag',
78 'sphinxcontrib.packetdiag'
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'
89 # Breathe extension variables
91 # Doxygen regenerates files in 'xml/' directory every time,
92 # but we copy files to 'xml_in/' only when they change, to speed up
94 breathe_projects = { "esp32-idf": "xml_in/" }
95 breathe_default_project = "esp32-idf"
97 # Add any paths that contain templates here, relative to this directory.
98 templates_path = ['_templates']
100 # The suffix of source filenames.
101 source_suffix = ['.rst', '.md']
104 '.md': 'recommonmark.parser.CommonMarkParser',
107 # The encoding of source files.
108 #source_encoding = 'utf-8-sig'
110 # The master toctree document.
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
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'.
129 print('Version: {0} Release: {1}'.format(version, release))
131 # There are two options for replacing |today|: either, you set today to some
132 # non-false value, then it is used:
134 # Else, today_fmt is used as the format for a strftime call.
135 #today_fmt = '%B %d, %Y'
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']
141 # The reST default role (used for this markup: `text`) to use for all
145 # If true, '()' will be appended to :func: etc. cross-reference text.
146 #add_function_parentheses = True
148 # If true, the current module name will be prepended to all description
149 # unit titles (such as .. function::).
150 #add_module_names = True
152 # If true, sectionauthor and moduleauthor directives will be shown in the
153 # output. They are ignored by default.
154 #show_authors = False
156 # The name of the Pygments (syntax highlighting) style to use.
157 pygments_style = 'sphinx'
159 # A list of ignored prefixes for module index sorting.
160 #modindex_common_prefix = []
162 # If true, keep warnings as "system message" paragraphs in the built documents.
163 #keep_warnings = False
166 # -- Options for HTML output ----------------------------------------------
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'
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
175 #html_theme_options = {}
177 # Add any paths that contain custom themes here, relative to this directory.
178 #html_theme_path = []
180 # The name for this set of Sphinx documents. If None, it defaults to
181 # "<project> v<release> documentation".
184 # A shorter title for the navigation bar. Default is the same as html_title.
185 #html_short_title = None
187 # The name of an image file (relative to this directory) to place at the top
189 html_logo = "../_static/espressif-logo.png"
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
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']
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 = []
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'
210 # If true, SmartyPants will be used to convert quotes and dashes to
211 # typographically correct entities.
212 #html_use_smartypants = True
214 # Custom sidebar templates, maps document names to template names.
217 # Additional templates that should be rendered to pages, maps page names to
219 #html_additional_pages = {}
221 # If false, no module index is generated.
222 #html_domain_indices = True
224 # If false, no index is generated.
225 #html_use_index = True
227 # If true, the index is split into individual pages for each letter.
228 #html_split_index = False
230 # If true, links to the reST sources are added to the pages.
231 #html_show_sourcelink = True
233 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
234 #html_show_sphinx = True
236 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
237 #html_show_copyright = True
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 = ''
244 # This is the file name suffix for HTML files (e.g. ".xhtml").
245 #html_file_suffix = None
247 # Output file base name for HTML help builder.
248 htmlhelp_basename = 'ReadtheDocsTemplatedoc'
251 # -- Options for LaTeX output ---------------------------------------------
254 # The paper size ('letterpaper' or 'a4paper').
255 #'papersize': 'letterpaper',
257 # The font size ('10pt', '11pt' or '12pt').
258 #'pointsize': '10pt',
260 # Additional stuff for the LaTeX preamble.
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]).
268 ('index', 'ReadtheDocsTemplate.tex', u'Read the Docs Template Documentation',
269 u'Read the Docs', 'manual'),
272 # The name of an image file (relative to this directory) to place at the top of
276 # For "manual" documents, if this is true, then toplevel headings are parts,
278 #latex_use_parts = False
280 # If true, show page references after internal links.
281 #latex_show_pagerefs = False
283 # If true, show URL addresses after external links.
284 #latex_show_urls = False
286 # Documents to append as an appendix to all manuals.
287 #latex_appendices = []
289 # If false, no module index is generated.
290 #latex_domain_indices = True
293 # -- Options for manual page output ---------------------------------------
295 # One entry per manual page. List of tuples
296 # (source start file, name, description, authors, manual section).
298 ('index', 'readthedocstemplate', u'Read the Docs Template Documentation',
299 [u'Read the Docs'], 1)
302 # If true, show URL addresses after external links.
303 #man_show_urls = False
306 # -- Options for Texinfo output -------------------------------------------
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.',
317 # Documents to append as an appendix to all manuals.
318 #texinfo_appendices = []
320 # If false, no module index is generated.
321 #texinfo_domain_indices = True
323 # How to display URL addresses: 'footnote', 'no', or 'inline'.
324 #texinfo_show_urls = 'footnote'
326 # If true, do not generate a @detailmenu in the "Top" node's menu.
327 #texinfo_no_detailmenu = False
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
332 # on_rtd is whether we are on readthedocs.org
333 on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
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()]
340 # otherwise, readthedocs.org uses their theme by default, so no need to specify it
342 # Override RTD CSS theme to introduce the theme corrections
343 # https://github.com/rtfd/sphinx_rtd_theme/pull/432
345 app.add_stylesheet('theme_overrides.css')