conf_common.py 12 KB

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