conf_common.py 11 KB

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