You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

332 lines
10 KiB

2 months ago
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. #
  4. # pybind11 documentation build configuration file, created by
  5. # sphinx-quickstart on Sun Oct 11 19:23:48 2015.
  6. #
  7. # This file is execfile()d with the current directory set to its
  8. # containing dir.
  9. #
  10. # Note that not all possible configuration values are present in this
  11. # autogenerated file.
  12. #
  13. # All configuration values have a default; values that are commented out
  14. # serve to show the default.
  15. import sys
  16. import os
  17. import shlex
  18. import subprocess
  19. # If extensions (or modules to document with autodoc) are in another directory,
  20. # add these directories to sys.path here. If the directory is relative to the
  21. # documentation root, use os.path.abspath to make it absolute, like shown here.
  22. #sys.path.insert(0, os.path.abspath('.'))
  23. # -- General configuration ------------------------------------------------
  24. # If your documentation needs a minimal Sphinx version, state it here.
  25. #needs_sphinx = '1.0'
  26. # Add any Sphinx extension module names here, as strings. They can be
  27. # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
  28. # ones.
  29. extensions = ['breathe']
  30. breathe_projects = {'pybind11': '.build/doxygenxml/'}
  31. breathe_default_project = 'pybind11'
  32. breathe_domain_by_extension = {'h': 'cpp'}
  33. # Add any paths that contain templates here, relative to this directory.
  34. templates_path = ['.templates']
  35. # The suffix(es) of source filenames.
  36. # You can specify multiple suffix as a list of string:
  37. # source_suffix = ['.rst', '.md']
  38. source_suffix = '.rst'
  39. # The encoding of source files.
  40. #source_encoding = 'utf-8-sig'
  41. # The master toctree document.
  42. master_doc = 'index'
  43. # General information about the project.
  44. project = 'pybind11'
  45. copyright = '2017, Wenzel Jakob'
  46. author = 'Wenzel Jakob'
  47. # The version info for the project you're documenting, acts as replacement for
  48. # |version| and |release|, also used in various other places throughout the
  49. # built documents.
  50. #
  51. # The short X.Y version.
  52. version = '2.2'
  53. # The full version, including alpha/beta/rc tags.
  54. release = '2.2.dev0'
  55. # The language for content autogenerated by Sphinx. Refer to documentation
  56. # for a list of supported languages.
  57. #
  58. # This is also used if you do content translation via gettext catalogs.
  59. # Usually you set "language" from the command line for these cases.
  60. language = None
  61. # There are two options for replacing |today|: either, you set today to some
  62. # non-false value, then it is used:
  63. #today = ''
  64. # Else, today_fmt is used as the format for a strftime call.
  65. #today_fmt = '%B %d, %Y'
  66. # List of patterns, relative to source directory, that match files and
  67. # directories to ignore when looking for source files.
  68. exclude_patterns = ['.build', 'release.rst']
  69. # The reST default role (used for this markup: `text`) to use for all
  70. # documents.
  71. default_role = 'any'
  72. # If true, '()' will be appended to :func: etc. cross-reference text.
  73. #add_function_parentheses = True
  74. # If true, the current module name will be prepended to all description
  75. # unit titles (such as .. function::).
  76. #add_module_names = True
  77. # If true, sectionauthor and moduleauthor directives will be shown in the
  78. # output. They are ignored by default.
  79. #show_authors = False
  80. # The name of the Pygments (syntax highlighting) style to use.
  81. #pygments_style = 'monokai'
  82. # A list of ignored prefixes for module index sorting.
  83. #modindex_common_prefix = []
  84. # If true, keep warnings as "system message" paragraphs in the built documents.
  85. #keep_warnings = False
  86. # If true, `todo` and `todoList` produce output, else they produce nothing.
  87. todo_include_todos = False
  88. # -- Options for HTML output ----------------------------------------------
  89. # The theme to use for HTML and HTML Help pages. See the documentation for
  90. # a list of builtin themes.
  91. on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
  92. if not on_rtd: # only import and set the theme if we're building docs locally
  93. import sphinx_rtd_theme
  94. html_theme = 'sphinx_rtd_theme'
  95. html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
  96. html_context = {
  97. 'css_files': [
  98. '_static/theme_overrides.css'
  99. ]
  100. }
  101. else:
  102. html_context = {
  103. 'css_files': [
  104. '//media.readthedocs.org/css/sphinx_rtd_theme.css',
  105. '//media.readthedocs.org/css/readthedocs-doc-embed.css',
  106. '_static/theme_overrides.css'
  107. ]
  108. }
  109. # Theme options are theme-specific and customize the look and feel of a theme
  110. # further. For a list of options available for each theme, see the
  111. # documentation.
  112. #html_theme_options = {}
  113. # Add any paths that contain custom themes here, relative to this directory.
  114. #html_theme_path = []
  115. # The name for this set of Sphinx documents. If None, it defaults to
  116. # "<project> v<release> documentation".
  117. #html_title = None
  118. # A shorter title for the navigation bar. Default is the same as html_title.
  119. #html_short_title = None
  120. # The name of an image file (relative to this directory) to place at the top
  121. # of the sidebar.
  122. #html_logo = None
  123. # The name of an image file (within the static path) to use as favicon of the
  124. # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
  125. # pixels large.
  126. #html_favicon = None
  127. # Add any paths that contain custom static files (such as style sheets) here,
  128. # relative to this directory. They are copied after the builtin static files,
  129. # so a file named "default.css" will overwrite the builtin "default.css".
  130. html_static_path = ['_static']
  131. # Add any extra paths that contain custom files (such as robots.txt or
  132. # .htaccess) here, relative to this directory. These files are copied
  133. # directly to the root of the documentation.
  134. #html_extra_path = []
  135. # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
  136. # using the given strftime format.
  137. #html_last_updated_fmt = '%b %d, %Y'
  138. # If true, SmartyPants will be used to convert quotes and dashes to
  139. # typographically correct entities.
  140. #html_use_smartypants = True
  141. # Custom sidebar templates, maps document names to template names.
  142. #html_sidebars = {}
  143. # Additional templates that should be rendered to pages, maps page names to
  144. # template names.
  145. #html_additional_pages = {}
  146. # If false, no module index is generated.
  147. #html_domain_indices = True
  148. # If false, no index is generated.
  149. #html_use_index = True
  150. # If true, the index is split into individual pages for each letter.
  151. #html_split_index = False
  152. # If true, links to the reST sources are added to the pages.
  153. #html_show_sourcelink = True
  154. # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
  155. #html_show_sphinx = True
  156. # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
  157. #html_show_copyright = True
  158. # If true, an OpenSearch description file will be output, and all pages will
  159. # contain a <link> tag referring to it. The value of this option must be the
  160. # base URL from which the finished HTML is served.
  161. #html_use_opensearch = ''
  162. # This is the file name suffix for HTML files (e.g. ".xhtml").
  163. #html_file_suffix = None
  164. # Language to be used for generating the HTML full-text search index.
  165. # Sphinx supports the following languages:
  166. # 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
  167. # 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
  168. #html_search_language = 'en'
  169. # A dictionary with options for the search language support, empty by default.
  170. # Now only 'ja' uses this config value
  171. #html_search_options = {'type': 'default'}
  172. # The name of a javascript file (relative to the configuration directory) that
  173. # implements a search results scorer. If empty, the default will be used.
  174. #html_search_scorer = 'scorer.js'
  175. # Output file base name for HTML help builder.
  176. htmlhelp_basename = 'pybind11doc'
  177. # -- Options for LaTeX output ---------------------------------------------
  178. latex_elements = {
  179. # The paper size ('letterpaper' or 'a4paper').
  180. #'papersize': 'letterpaper',
  181. # The font size ('10pt', '11pt' or '12pt').
  182. #'pointsize': '10pt',
  183. # Additional stuff for the LaTeX preamble.
  184. 'preamble': '\DeclareUnicodeCharacter{00A0}{}',
  185. # Latex figure (float) alignment
  186. #'figure_align': 'htbp',
  187. }
  188. # Grouping the document tree into LaTeX files. List of tuples
  189. # (source start file, target name, title,
  190. # author, documentclass [howto, manual, or own class]).
  191. latex_documents = [
  192. (master_doc, 'pybind11.tex', 'pybind11 Documentation',
  193. 'Wenzel Jakob', 'manual'),
  194. ]
  195. # The name of an image file (relative to this directory) to place at the top of
  196. # the title page.
  197. # latex_logo = 'pybind11-logo.png'
  198. # For "manual" documents, if this is true, then toplevel headings are parts,
  199. # not chapters.
  200. #latex_use_parts = False
  201. # If true, show page references after internal links.
  202. #latex_show_pagerefs = False
  203. # If true, show URL addresses after external links.
  204. #latex_show_urls = False
  205. # Documents to append as an appendix to all manuals.
  206. #latex_appendices = []
  207. # If false, no module index is generated.
  208. #latex_domain_indices = True
  209. # -- Options for manual page output ---------------------------------------
  210. # One entry per manual page. List of tuples
  211. # (source start file, name, description, authors, manual section).
  212. man_pages = [
  213. (master_doc, 'pybind11', 'pybind11 Documentation',
  214. [author], 1)
  215. ]
  216. # If true, show URL addresses after external links.
  217. #man_show_urls = False
  218. # -- Options for Texinfo output -------------------------------------------
  219. # Grouping the document tree into Texinfo files. List of tuples
  220. # (source start file, target name, title, author,
  221. # dir menu entry, description, category)
  222. texinfo_documents = [
  223. (master_doc, 'pybind11', 'pybind11 Documentation',
  224. author, 'pybind11', 'One line description of project.',
  225. 'Miscellaneous'),
  226. ]
  227. # Documents to append as an appendix to all manuals.
  228. #texinfo_appendices = []
  229. # If false, no module index is generated.
  230. #texinfo_domain_indices = True
  231. # How to display URL addresses: 'footnote', 'no', or 'inline'.
  232. #texinfo_show_urls = 'footnote'
  233. # If true, do not generate a @detailmenu in the "Top" node's menu.
  234. #texinfo_no_detailmenu = False
  235. primary_domain = 'cpp'
  236. highlight_language = 'cpp'
  237. def generate_doxygen_xml(app):
  238. build_dir = '.build'
  239. if not os.path.exists(build_dir):
  240. os.mkdir(build_dir)
  241. try:
  242. subprocess.call(['doxygen', '--version'])
  243. retcode = subprocess.call(['doxygen'])
  244. if retcode < 0:
  245. sys.stderr.write("doxygen error code: {}\n".format(-retcode))
  246. except OSError as e:
  247. sys.stderr.write("doxygen execution failed: {}\n".format(e))
  248. def setup(app):
  249. """Add hook for building doxygen xml when needed"""
  250. app.connect("builder-inited", generate_doxygen_xml)