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 os.system("doxygen ../Doxyfile")
36 # Doxygen has generated XML files in 'xml' directory.
37 # Copy them to 'xml_in', only touching the files which have changed.
38 copy_if_modified('xml/', 'xml_in/')
40 # Generate 'api_name.inc' files using the XML files by Doxygen
41 os.system('python ../gen-dxd.py')
43 # Generate 'kconfig.inc' file from components' Kconfig files
44 kconfig_inc_path = '{}/inc/kconfig.inc'.format(builddir)
45 os.system('python ../gen-kconfig-doc.py > ' + kconfig_inc_path + '.in')
46 copy_if_modified(kconfig_inc_path + '.in', kconfig_inc_path)
48 # http://stackoverflow.com/questions/12772927/specifying-an-online-image-in-sphinx-restructuredtext-format
50 suppress_warnings = ['image.nonlocal_uri']
52 # -- General configuration ------------------------------------------------
54 # If your documentation needs a minimal Sphinx version, state it here.
57 # Add any Sphinx extension module names here, as strings. They can be
58 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
60 extensions = ['breathe',
62 'sphinxcontrib.blockdiag',
63 'sphinxcontrib.seqdiag',
64 'sphinxcontrib.actdiag',
65 'sphinxcontrib.nwdiag',
66 'sphinxcontrib.rackdiag',
67 'sphinxcontrib.packetdiag'
70 # Set up font for blockdiag, nwdiag, rackdiag and packetdiag
71 blockdiag_fontpath = '../_static/DejaVuSans.ttf'
72 seqdiag_fontpath = '../_static/DejaVuSans.ttf'
73 actdiag_fontpath = '../_static/DejaVuSans.ttf'
74 nwdiag_fontpath = '../_static/DejaVuSans.ttf'
75 rackdiag_fontpath = '../_static/DejaVuSans.ttf'
76 packetdiag_fontpath = '../_static/DejaVuSans.ttf'
78 # Breathe extension variables
80 # Doxygen regenerates files in 'xml/' directory every time,
81 # but we copy files to 'xml_in/' only when they change, to speed up
83 breathe_projects = { "esp32-idf": "xml_in/" }
84 breathe_default_project = "esp32-idf"
86 # Add any paths that contain templates here, relative to this directory.
87 templates_path = ['_templates']
89 # The suffix of source filenames.
90 source_suffix = ['.rst', '.md']
93 '.md': 'recommonmark.parser.CommonMarkParser',
96 # The encoding of source files.
97 #source_encoding = 'utf-8-sig'
99 # The master toctree document.
103 # The version info for the project you're documenting, acts as replacement for
104 # |version| and |release|, also used in various other places throughout the
108 # Readthedocs largely ignores 'version' and 'release', and displays one of
109 # 'latest', tag name, or branch name, depending on the build type.
110 # Still, this is useful for non-RTD builds.
111 # This is supposed to be "the short X.Y version", but it's the only version
112 # visible when you open index.html.
113 # Display full version to make things less confusing.
114 version = run_cmd_get_output('git describe')
115 # The full version, including alpha/beta/rc tags.
116 # If needed, nearest tag is returned by 'git describe --abbrev=0'.
118 print('Version: {0} Release: {1}'.format(version, release))
120 # There are two options for replacing |today|: either, you set today to some
121 # non-false value, then it is used:
123 # Else, today_fmt is used as the format for a strftime call.
124 #today_fmt = '%B %d, %Y'
126 # List of patterns, relative to source directory, that match files and
127 # directories to ignore when looking for source files.
128 exclude_patterns = ['_build','README.md']
130 # The reST default role (used for this markup: `text`) to use for all
134 # If true, '()' will be appended to :func: etc. cross-reference text.
135 #add_function_parentheses = True
137 # If true, the current module name will be prepended to all description
138 # unit titles (such as .. function::).
139 #add_module_names = True
141 # If true, sectionauthor and moduleauthor directives will be shown in the
142 # output. They are ignored by default.
143 #show_authors = False
145 # The name of the Pygments (syntax highlighting) style to use.
146 pygments_style = 'sphinx'
148 # A list of ignored prefixes for module index sorting.
149 #modindex_common_prefix = []
151 # If true, keep warnings as "system message" paragraphs in the built documents.
152 #keep_warnings = False
155 # -- Options for HTML output ----------------------------------------------
157 # The theme to use for HTML and HTML Help pages. See the documentation for
158 # a list of builtin themes.
159 html_theme = 'default'
161 # Theme options are theme-specific and customize the look and feel of a theme
162 # further. For a list of options available for each theme, see the
164 #html_theme_options = {}
166 # Add any paths that contain custom themes here, relative to this directory.
167 #html_theme_path = []
169 # The name for this set of Sphinx documents. If None, it defaults to
170 # "<project> v<release> documentation".
173 # A shorter title for the navigation bar. Default is the same as html_title.
174 #html_short_title = None
176 # The name of an image file (relative to this directory) to place at the top
180 # The name of an image file (within the static path) to use as favicon of the
181 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
185 # Add any paths that contain custom static files (such as style sheets) here,
186 # relative to this directory. They are copied after the builtin static files,
187 # so a file named "default.css" will overwrite the builtin "default.css".
188 html_static_path = ['../_static']
190 # Add any extra paths that contain custom files (such as robots.txt or
191 # .htaccess) here, relative to this directory. These files are copied
192 # directly to the root of the documentation.
193 #html_extra_path = []
195 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
196 # using the given strftime format.
197 #html_last_updated_fmt = '%b %d, %Y'
199 # If true, SmartyPants will be used to convert quotes and dashes to
200 # typographically correct entities.
201 #html_use_smartypants = True
203 # Custom sidebar templates, maps document names to template names.
206 # Additional templates that should be rendered to pages, maps page names to
208 #html_additional_pages = {}
210 # If false, no module index is generated.
211 #html_domain_indices = True
213 # If false, no index is generated.
214 #html_use_index = True
216 # If true, the index is split into individual pages for each letter.
217 #html_split_index = False
219 # If true, links to the reST sources are added to the pages.
220 #html_show_sourcelink = True
222 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
223 #html_show_sphinx = True
225 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
226 #html_show_copyright = True
228 # If true, an OpenSearch description file will be output, and all pages will
229 # contain a <link> tag referring to it. The value of this option must be the
230 # base URL from which the finished HTML is served.
231 #html_use_opensearch = ''
233 # This is the file name suffix for HTML files (e.g. ".xhtml").
234 #html_file_suffix = None
236 # Output file base name for HTML help builder.
237 htmlhelp_basename = 'ReadtheDocsTemplatedoc'
240 # -- Options for LaTeX output ---------------------------------------------
243 # The paper size ('letterpaper' or 'a4paper').
244 #'papersize': 'letterpaper',
246 # The font size ('10pt', '11pt' or '12pt').
247 #'pointsize': '10pt',
249 # Additional stuff for the LaTeX preamble.
253 # Grouping the document tree into LaTeX files. List of tuples
254 # (source start file, target name, title,
255 # author, documentclass [howto, manual, or own class]).
257 ('index', 'ReadtheDocsTemplate.tex', u'Read the Docs Template Documentation',
258 u'Read the Docs', 'manual'),
261 # The name of an image file (relative to this directory) to place at the top of
265 # For "manual" documents, if this is true, then toplevel headings are parts,
267 #latex_use_parts = False
269 # If true, show page references after internal links.
270 #latex_show_pagerefs = False
272 # If true, show URL addresses after external links.
273 #latex_show_urls = False
275 # Documents to append as an appendix to all manuals.
276 #latex_appendices = []
278 # If false, no module index is generated.
279 #latex_domain_indices = True
282 # -- Options for manual page output ---------------------------------------
284 # One entry per manual page. List of tuples
285 # (source start file, name, description, authors, manual section).
287 ('index', 'readthedocstemplate', u'Read the Docs Template Documentation',
288 [u'Read the Docs'], 1)
291 # If true, show URL addresses after external links.
292 #man_show_urls = False
295 # -- Options for Texinfo output -------------------------------------------
297 # Grouping the document tree into Texinfo files. List of tuples
298 # (source start file, target name, title, author,
299 # dir menu entry, description, category)
300 texinfo_documents = [
301 ('index', 'ReadtheDocsTemplate', u'Read the Docs Template Documentation',
302 u'Read the Docs', 'ReadtheDocsTemplate', 'One line description of project.',
306 # Documents to append as an appendix to all manuals.
307 #texinfo_appendices = []
309 # If false, no module index is generated.
310 #texinfo_domain_indices = True
312 # How to display URL addresses: 'footnote', 'no', or 'inline'.
313 #texinfo_show_urls = 'footnote'
315 # If true, do not generate a @detailmenu in the "Top" node's menu.
316 #texinfo_no_detailmenu = False
318 # -- Use sphinx_rtd_theme for local builds --------------------------------
319 # ref. https://github.com/snide/sphinx_rtd_theme#using-this-theme-locally-then-building-on-read-the-docs
321 # on_rtd is whether we are on readthedocs.org
322 on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
324 if not on_rtd: # only import and set the theme if we're building docs locally
325 import sphinx_rtd_theme
326 html_theme = 'sphinx_rtd_theme'
327 html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
329 # otherwise, readthedocs.org uses their theme by default, so no need to specify it
331 # Override RTD CSS theme to introduce the theme corrections
332 # https://github.com/rtfd/sphinx_rtd_theme/pull/432
334 app.add_stylesheet('theme_overrides.css')