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