cppyabm  1.0.17
An agent-based library to integrate C++ and Python
conf.py
Go to the documentation of this file.
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 
16 import sys
17 import os
18 import shlex
19 import subprocess
20 from pathlib import Path
21 import re
22 
23 DIR = Path(__file__).parent.resolve()
24 
25 # If extensions (or modules to document with autodoc) are in another directory,
26 # add these directories to sys.path here. If the directory is relative to the
27 # documentation root, use os.path.abspath to make it absolute, like shown here.
28 # sys.path.insert(0, os.path.abspath('.'))
29 
30 # -- General configuration ------------------------------------------------
31 
32 # If your documentation needs a minimal Sphinx version, state it here.
33 # needs_sphinx = '1.0'
34 
35 # Add any Sphinx extension module names here, as strings. They can be
36 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
37 # ones.
38 extensions = [
39  "breathe",
40  "sphinxcontrib.rsvgconverter",
41  "sphinxcontrib.moderncmakedomain",
42 ]
43 
44 breathe_projects = {"pybind11": ".build/doxygenxml/"}
45 breathe_default_project = "pybind11"
46 breathe_domain_by_extension = {"h": "cpp"}
47 
48 # Add any paths that contain templates here, relative to this directory.
49 templates_path = [".templates"]
50 
51 # The suffix(es) of source filenames.
52 # You can specify multiple suffix as a list of string:
53 # source_suffix = ['.rst', '.md']
54 source_suffix = ".rst"
55 
56 # The encoding of source files.
57 # source_encoding = 'utf-8-sig'
58 
59 # The master toctree document.
60 master_doc = "index"
61 
62 # General information about the project.
63 project = "pybind11"
64 copyright = "2017, Wenzel Jakob"
65 author = "Wenzel Jakob"
66 
67 # The version info for the project you're documenting, acts as replacement for
68 # |version| and |release|, also used in various other places throughout the
69 # built documents.
70 
71 # Read the listed version
72 with open("../pybind11/_version.py") as f:
73  code = compile(f.read(), "../pybind11/_version.py", "exec")
74 loc = {}
75 exec(code, loc)
76 
77 # The full version, including alpha/beta/rc tags.
78 version = loc["__version__"]
79 
80 # The language for content autogenerated by Sphinx. Refer to documentation
81 # for a list of supported languages.
82 #
83 # This is also used if you do content translation via gettext catalogs.
84 # Usually you set "language" from the command line for these cases.
85 language = None
86 
87 # There are two options for replacing |today|: either, you set today to some
88 # non-false value, then it is used:
89 # today = ''
90 # Else, today_fmt is used as the format for a strftime call.
91 # today_fmt = '%B %d, %Y'
92 
93 # List of patterns, relative to source directory, that match files and
94 # directories to ignore when looking for source files.
95 exclude_patterns = [".build", "release.rst"]
96 
97 # The reST default role (used for this markup: `text`) to use for all
98 # documents.
99 default_role = "any"
100 
101 # If true, '()' will be appended to :func: etc. cross-reference text.
102 # add_function_parentheses = True
103 
104 # If true, the current module name will be prepended to all description
105 # unit titles (such as .. function::).
106 # add_module_names = True
107 
108 # If true, sectionauthor and moduleauthor directives will be shown in the
109 # output. They are ignored by default.
110 # show_authors = False
111 
112 # The name of the Pygments (syntax highlighting) style to use.
113 # pygments_style = 'monokai'
114 
115 # A list of ignored prefixes for module index sorting.
116 # modindex_common_prefix = []
117 
118 # If true, keep warnings as "system message" paragraphs in the built documents.
119 # keep_warnings = False
120 
121 # If true, `todo` and `todoList` produce output, else they produce nothing.
122 todo_include_todos = False
123 
124 
125 # -- Options for HTML output ----------------------------------------------
126 
127 # The theme to use for HTML and HTML Help pages. See the documentation for
128 # a list of builtin themes.
129 
130 on_rtd = os.environ.get("READTHEDOCS", None) == "True"
131 
132 if not on_rtd: # only import and set the theme if we're building docs locally
133  import sphinx_rtd_theme
134 
135  html_theme = "sphinx_rtd_theme"
136  html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
137 
138  html_context = {"css_files": ["_static/theme_overrides.css"]}
139 else:
140  html_context = {
141  "css_files": [
142  "//media.readthedocs.org/css/sphinx_rtd_theme.css",
143  "//media.readthedocs.org/css/readthedocs-doc-embed.css",
144  "_static/theme_overrides.css",
145  ]
146  }
147 
148 # Theme options are theme-specific and customize the look and feel of a theme
149 # further. For a list of options available for each theme, see the
150 # documentation.
151 # html_theme_options = {}
152 
153 # Add any paths that contain custom themes here, relative to this directory.
154 # html_theme_path = []
155 
156 # The name for this set of Sphinx documents. If None, it defaults to
157 # "<project> v<version> documentation".
158 # html_title = None
159 
160 # A shorter title for the navigation bar. Default is the same as html_title.
161 # html_short_title = None
162 
163 # The name of an image file (relative to this directory) to place at the top
164 # of the sidebar.
165 # html_logo = None
166 
167 # The name of an image file (within the static path) to use as favicon of the
168 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
169 # pixels large.
170 # html_favicon = None
171 
172 # Add any paths that contain custom static files (such as style sheets) here,
173 # relative to this directory. They are copied after the builtin static files,
174 # so a file named "default.css" will overwrite the builtin "default.css".
175 html_static_path = ["_static"]
176 
177 # Add any extra paths that contain custom files (such as robots.txt or
178 # .htaccess) here, relative to this directory. These files are copied
179 # directly to the root of the documentation.
180 # html_extra_path = []
181 
182 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
183 # using the given strftime format.
184 # html_last_updated_fmt = '%b %d, %Y'
185 
186 # If true, SmartyPants will be used to convert quotes and dashes to
187 # typographically correct entities.
188 # html_use_smartypants = True
189 
190 # Custom sidebar templates, maps document names to template names.
191 # html_sidebars = {}
192 
193 # Additional templates that should be rendered to pages, maps page names to
194 # template names.
195 # html_additional_pages = {}
196 
197 # If false, no module index is generated.
198 # html_domain_indices = True
199 
200 # If false, no index is generated.
201 # html_use_index = True
202 
203 # If true, the index is split into individual pages for each letter.
204 # html_split_index = False
205 
206 # If true, links to the reST sources are added to the pages.
207 # html_show_sourcelink = True
208 
209 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
210 # html_show_sphinx = True
211 
212 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
213 # html_show_copyright = True
214 
215 # If true, an OpenSearch description file will be output, and all pages will
216 # contain a <link> tag referring to it. The value of this option must be the
217 # base URL from which the finished HTML is served.
218 # html_use_opensearch = ''
219 
220 # This is the file name suffix for HTML files (e.g. ".xhtml").
221 # html_file_suffix = None
222 
223 # Language to be used for generating the HTML full-text search index.
224 # Sphinx supports the following languages:
225 # 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
226 # 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
227 # html_search_language = 'en'
228 
229 # A dictionary with options for the search language support, empty by default.
230 # Now only 'ja' uses this config value
231 # html_search_options = {'type': 'default'}
232 
233 # The name of a javascript file (relative to the configuration directory) that
234 # implements a search results scorer. If empty, the default will be used.
235 # html_search_scorer = 'scorer.js'
236 
237 # Output file base name for HTML help builder.
238 htmlhelp_basename = "pybind11doc"
239 
240 # -- Options for LaTeX output ---------------------------------------------
241 
242 latex_engine = "pdflatex"
243 
244 latex_elements = {
245  # The paper size ('letterpaper' or 'a4paper').
246  # 'papersize': 'letterpaper',
247  #
248  # The font size ('10pt', '11pt' or '12pt').
249  # 'pointsize': '10pt',
250  #
251  # Additional stuff for the LaTeX preamble.
252  # remove blank pages (between the title page and the TOC, etc.)
253  "classoptions": ",openany,oneside",
254  "preamble": r"""
255 \usepackage{fontawesome}
256 \usepackage{textgreek}
257 \DeclareUnicodeCharacter{00A0}{}
258 \DeclareUnicodeCharacter{2194}{\faArrowsH}
259 \DeclareUnicodeCharacter{1F382}{\faBirthdayCake}
260 \DeclareUnicodeCharacter{1F355}{\faAdjust}
261 \DeclareUnicodeCharacter{0301}{'}
262 \DeclareUnicodeCharacter{03C0}{\textpi}
263 
264 """,
265  # Latex figure (float) alignment
266  # 'figure_align': 'htbp',
267 }
268 
269 # Grouping the document tree into LaTeX files. List of tuples
270 # (source start file, target name, title,
271 # author, documentclass [howto, manual, or own class]).
272 latex_documents = [
273  (master_doc, "pybind11.tex", "pybind11 Documentation", "Wenzel Jakob", "manual"),
274 ]
275 
276 # The name of an image file (relative to this directory) to place at the top of
277 # the title page.
278 # latex_logo = 'pybind11-logo.png'
279 
280 # For "manual" documents, if this is true, then toplevel headings are parts,
281 # not chapters.
282 # latex_use_parts = False
283 
284 # If true, show page references after internal links.
285 # latex_show_pagerefs = False
286 
287 # If true, show URL addresses after external links.
288 # latex_show_urls = False
289 
290 # Documents to append as an appendix to all manuals.
291 # latex_appendices = []
292 
293 # If false, no module index is generated.
294 # latex_domain_indices = True
295 
296 
297 # -- Options for manual page output ---------------------------------------
298 
299 # One entry per manual page. List of tuples
300 # (source start file, name, description, authors, manual section).
301 man_pages = [(master_doc, "pybind11", "pybind11 Documentation", [author], 1)]
302 
303 # If true, show URL addresses after external links.
304 # man_show_urls = False
305 
306 
307 # -- Options for Texinfo output -------------------------------------------
308 
309 # Grouping the document tree into Texinfo files. List of tuples
310 # (source start file, target name, title, author,
311 # dir menu entry, description, category)
312 texinfo_documents = [
313  (
314  master_doc,
315  "pybind11",
316  "pybind11 Documentation",
317  author,
318  "pybind11",
319  "One line description of project.",
320  "Miscellaneous",
321  ),
322 ]
323 
324 # Documents to append as an appendix to all manuals.
325 # texinfo_appendices = []
326 
327 # If false, no module index is generated.
328 # texinfo_domain_indices = True
329 
330 # How to display URL addresses: 'footnote', 'no', or 'inline'.
331 # texinfo_show_urls = 'footnote'
332 
333 # If true, do not generate a @detailmenu in the "Top" node's menu.
334 # texinfo_no_detailmenu = False
335 
336 primary_domain = "cpp"
337 highlight_language = "cpp"
338 
339 
341  build_dir = os.path.join(app.confdir, ".build")
342  if not os.path.exists(build_dir):
343  os.mkdir(build_dir)
344 
345  try:
346  subprocess.call(["doxygen", "--version"])
347  retcode = subprocess.call(["doxygen"], cwd=app.confdir)
348  if retcode < 0:
349  sys.stderr.write("doxygen error code: {}\n".format(-retcode))
350  except OSError as e:
351  sys.stderr.write("doxygen execution failed: {}\n".format(e))
352 
353 
354 def prepare(app):
355  with open(DIR.parent / "README.rst") as f:
356  contents = f.read()
357 
358  if app.builder.name == "latex":
359  # Remove badges and stuff from start
360  contents = contents[contents.find(r".. start") :]
361 
362  # Filter out section titles for index.rst for LaTeX
363  contents = re.sub(r"^(.*)\n[-~]{3,}$", r"**\1**", contents, flags=re.MULTILINE)
364 
365  with open(DIR / "readme.rst", "w") as f:
366  f.write(contents)
367 
368 
369 def clean_up(app, exception):
370  (DIR / "readme.rst").unlink()
371 
372 
373 def setup(app):
374 
375  # Add hook for building doxygen xml when needed
376  app.connect("builder-inited", generate_doxygen_xml)
377 
378  # Copy the readme in
379  app.connect("builder-inited", prepare)
380 
381  # Clean up the generated readme
382  app.connect("build-finished", clean_up)
exec
void exec(str expr, object global=globals(), object local=object())
Definition: eval.h:78
conf.clean_up
def clean_up(app, exception)
Definition: conf.py:369
conf.prepare
def prepare(app)
Definition: conf.py:354
conf.generate_doxygen_xml
def generate_doxygen_xml(app)
Definition: conf.py:340
conf.setup
def setup(app)
Definition: conf.py:373