Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:17:43

0001 #!/usr/bin/env python3
0002 #
0003 # pybind11 documentation build configuration file, created by
0004 # sphinx-quickstart on Sun Oct 11 19:23:48 2015.
0005 #
0006 # This file is execfile()d with the current directory set to its
0007 # containing dir.
0008 #
0009 # Note that not all possible configuration values are present in this
0010 # autogenerated file.
0011 #
0012 # All configuration values have a default; values that are commented out
0013 # serve to show the default.
0014 
0015 import os
0016 import re
0017 import subprocess
0018 import sys
0019 from pathlib import Path
0020 
0021 DIR = Path(__file__).parent.resolve()
0022 
0023 # If extensions (or modules to document with autodoc) are in another directory,
0024 # add these directories to sys.path here. If the directory is relative to the
0025 # documentation root, use os.path.abspath to make it absolute, like shown here.
0026 # sys.path.insert(0, os.path.abspath('.'))
0027 
0028 # -- General configuration ------------------------------------------------
0029 
0030 # If your documentation needs a minimal Sphinx version, state it here.
0031 # needs_sphinx = '1.0'
0032 
0033 # Add any Sphinx extension module names here, as strings. They can be
0034 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
0035 # ones.
0036 extensions = [
0037     "breathe",
0038     "sphinx_copybutton",
0039     "sphinxcontrib.rsvgconverter",
0040     "sphinxcontrib.moderncmakedomain",
0041 ]
0042 
0043 breathe_projects = {"pybind11": ".build/doxygenxml/"}
0044 breathe_default_project = "pybind11"
0045 breathe_domain_by_extension = {"h": "cpp"}
0046 
0047 # Add any paths that contain templates here, relative to this directory.
0048 templates_path = [".templates"]
0049 
0050 # The suffix(es) of source filenames.
0051 # You can specify multiple suffix as a list of string:
0052 # source_suffix = ['.rst', '.md']
0053 source_suffix = ".rst"
0054 
0055 # The encoding of source files.
0056 # source_encoding = 'utf-8-sig'
0057 
0058 # The master toctree document.
0059 master_doc = "index"
0060 
0061 # General information about the project.
0062 project = "pybind11"
0063 copyright = "2017, Wenzel Jakob"
0064 author = "Wenzel Jakob"
0065 
0066 # The version info for the project you're documenting, acts as replacement for
0067 # |version| and |release|, also used in various other places throughout the
0068 # built documents.
0069 
0070 # Read the listed version
0071 with open("../pybind11/_version.py") as f:
0072     code = compile(f.read(), "../pybind11/_version.py", "exec")
0073 loc = {}
0074 exec(code, loc)
0075 
0076 # The full version, including alpha/beta/rc tags.
0077 version = loc["__version__"]
0078 
0079 # The language for content autogenerated by Sphinx. Refer to documentation
0080 # for a list of supported languages.
0081 #
0082 # This is also used if you do content translation via gettext catalogs.
0083 # Usually you set "language" from the command line for these cases.
0084 language = None
0085 
0086 # There are two options for replacing |today|: either, you set today to some
0087 # non-false value, then it is used:
0088 # today = ''
0089 # Else, today_fmt is used as the format for a strftime call.
0090 # today_fmt = '%B %d, %Y'
0091 
0092 # List of patterns, relative to source directory, that match files and
0093 # directories to ignore when looking for source files.
0094 exclude_patterns = [".build", "release.rst"]
0095 
0096 # The reST default role (used for this markup: `text`) to use for all
0097 # documents.
0098 default_role = "any"
0099 
0100 # If true, '()' will be appended to :func: etc. cross-reference text.
0101 # add_function_parentheses = True
0102 
0103 # If true, the current module name will be prepended to all description
0104 # unit titles (such as .. function::).
0105 # add_module_names = True
0106 
0107 # If true, sectionauthor and moduleauthor directives will be shown in the
0108 # output. They are ignored by default.
0109 # show_authors = False
0110 
0111 # The name of the Pygments (syntax highlighting) style to use.
0112 # pygments_style = 'monokai'
0113 
0114 # A list of ignored prefixes for module index sorting.
0115 # modindex_common_prefix = []
0116 
0117 # If true, keep warnings as "system message" paragraphs in the built documents.
0118 # keep_warnings = False
0119 
0120 # If true, `todo` and `todoList` produce output, else they produce nothing.
0121 todo_include_todos = False
0122 
0123 
0124 # -- Options for HTML output ----------------------------------------------
0125 
0126 # The theme to use for HTML and HTML Help pages.  See the documentation for
0127 # a list of builtin themes.
0128 
0129 html_theme = "furo"
0130 
0131 # Theme options are theme-specific and customize the look and feel of a theme
0132 # further.  For a list of options available for each theme, see the
0133 # documentation.
0134 # html_theme_options = {}
0135 
0136 # Add any paths that contain custom themes here, relative to this directory.
0137 # html_theme_path = []
0138 
0139 # The name for this set of Sphinx documents.  If None, it defaults to
0140 # "<project> v<version> documentation".
0141 # html_title = None
0142 
0143 # A shorter title for the navigation bar.  Default is the same as html_title.
0144 # html_short_title = None
0145 
0146 # The name of an image file (relative to this directory) to place at the top
0147 # of the sidebar.
0148 # html_logo = None
0149 
0150 # The name of an image file (within the static path) to use as favicon of the
0151 # docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
0152 # pixels large.
0153 # html_favicon = None
0154 
0155 # Add any paths that contain custom static files (such as style sheets) here,
0156 # relative to this directory. They are copied after the builtin static files,
0157 # so a file named "default.css" will overwrite the builtin "default.css".
0158 html_static_path = ["_static"]
0159 
0160 html_css_files = [
0161     "css/custom.css",
0162 ]
0163 
0164 # Add any extra paths that contain custom files (such as robots.txt or
0165 # .htaccess) here, relative to this directory. These files are copied
0166 # directly to the root of the documentation.
0167 # html_extra_path = []
0168 
0169 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
0170 # using the given strftime format.
0171 # html_last_updated_fmt = '%b %d, %Y'
0172 
0173 # If true, SmartyPants will be used to convert quotes and dashes to
0174 # typographically correct entities.
0175 # html_use_smartypants = True
0176 
0177 # Custom sidebar templates, maps document names to template names.
0178 # html_sidebars = {}
0179 
0180 # Additional templates that should be rendered to pages, maps page names to
0181 # template names.
0182 # html_additional_pages = {}
0183 
0184 # If false, no module index is generated.
0185 # html_domain_indices = True
0186 
0187 # If false, no index is generated.
0188 # html_use_index = True
0189 
0190 # If true, the index is split into individual pages for each letter.
0191 # html_split_index = False
0192 
0193 # If true, links to the reST sources are added to the pages.
0194 # html_show_sourcelink = True
0195 
0196 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
0197 # html_show_sphinx = True
0198 
0199 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
0200 # html_show_copyright = True
0201 
0202 # If true, an OpenSearch description file will be output, and all pages will
0203 # contain a <link> tag referring to it.  The value of this option must be the
0204 # base URL from which the finished HTML is served.
0205 # html_use_opensearch = ''
0206 
0207 # This is the file name suffix for HTML files (e.g. ".xhtml").
0208 # html_file_suffix = None
0209 
0210 # Language to be used for generating the HTML full-text search index.
0211 # Sphinx supports the following languages:
0212 #   'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
0213 #   'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
0214 # html_search_language = 'en'
0215 
0216 # A dictionary with options for the search language support, empty by default.
0217 # Now only 'ja' uses this config value
0218 # html_search_options = {'type': 'default'}
0219 
0220 # The name of a javascript file (relative to the configuration directory) that
0221 # implements a search results scorer. If empty, the default will be used.
0222 # html_search_scorer = 'scorer.js'
0223 
0224 # Output file base name for HTML help builder.
0225 htmlhelp_basename = "pybind11doc"
0226 
0227 # -- Options for LaTeX output ---------------------------------------------
0228 
0229 latex_engine = "pdflatex"
0230 
0231 latex_elements = {
0232     # The paper size ('letterpaper' or 'a4paper').
0233     # 'papersize': 'letterpaper',
0234     #
0235     # The font size ('10pt', '11pt' or '12pt').
0236     # 'pointsize': '10pt',
0237     #
0238     # Additional stuff for the LaTeX preamble.
0239     # remove blank pages (between the title page and the TOC, etc.)
0240     "classoptions": ",openany,oneside",
0241     "preamble": r"""
0242 \usepackage{fontawesome}
0243 \usepackage{textgreek}
0244 \DeclareUnicodeCharacter{00A0}{}
0245 \DeclareUnicodeCharacter{2194}{\faArrowsH}
0246 \DeclareUnicodeCharacter{1F382}{\faBirthdayCake}
0247 \DeclareUnicodeCharacter{1F355}{\faAdjust}
0248 \DeclareUnicodeCharacter{0301}{'}
0249 \DeclareUnicodeCharacter{03C0}{\textpi}
0250 
0251 """,
0252     # Latex figure (float) alignment
0253     # 'figure_align': 'htbp',
0254 }
0255 
0256 # Grouping the document tree into LaTeX files. List of tuples
0257 # (source start file, target name, title,
0258 #  author, documentclass [howto, manual, or own class]).
0259 latex_documents = [
0260     (master_doc, "pybind11.tex", "pybind11 Documentation", "Wenzel Jakob", "manual"),
0261 ]
0262 
0263 # The name of an image file (relative to this directory) to place at the top of
0264 # the title page.
0265 # latex_logo = 'pybind11-logo.png'
0266 
0267 # For "manual" documents, if this is true, then toplevel headings are parts,
0268 # not chapters.
0269 # latex_use_parts = False
0270 
0271 # If true, show page references after internal links.
0272 # latex_show_pagerefs = False
0273 
0274 # If true, show URL addresses after external links.
0275 # latex_show_urls = False
0276 
0277 # Documents to append as an appendix to all manuals.
0278 # latex_appendices = []
0279 
0280 # If false, no module index is generated.
0281 # latex_domain_indices = True
0282 
0283 
0284 # -- Options for manual page output ---------------------------------------
0285 
0286 # One entry per manual page. List of tuples
0287 # (source start file, name, description, authors, manual section).
0288 man_pages = [(master_doc, "pybind11", "pybind11 Documentation", [author], 1)]
0289 
0290 # If true, show URL addresses after external links.
0291 # man_show_urls = False
0292 
0293 
0294 # -- Options for Texinfo output -------------------------------------------
0295 
0296 # Grouping the document tree into Texinfo files. List of tuples
0297 # (source start file, target name, title, author,
0298 #  dir menu entry, description, category)
0299 texinfo_documents = [
0300     (
0301         master_doc,
0302         "pybind11",
0303         "pybind11 Documentation",
0304         author,
0305         "pybind11",
0306         "One line description of project.",
0307         "Miscellaneous",
0308     ),
0309 ]
0310 
0311 # Documents to append as an appendix to all manuals.
0312 # texinfo_appendices = []
0313 
0314 # If false, no module index is generated.
0315 # texinfo_domain_indices = True
0316 
0317 # How to display URL addresses: 'footnote', 'no', or 'inline'.
0318 # texinfo_show_urls = 'footnote'
0319 
0320 # If true, do not generate a @detailmenu in the "Top" node's menu.
0321 # texinfo_no_detailmenu = False
0322 
0323 primary_domain = "cpp"
0324 highlight_language = "cpp"
0325 
0326 
0327 def generate_doxygen_xml(app):
0328     build_dir = os.path.join(app.confdir, ".build")
0329     if not os.path.exists(build_dir):
0330         os.mkdir(build_dir)
0331 
0332     try:
0333         subprocess.call(["doxygen", "--version"])
0334         retcode = subprocess.call(["doxygen"], cwd=app.confdir)
0335         if retcode < 0:
0336             sys.stderr.write(f"doxygen error code: {-retcode}\n")
0337     except OSError as e:
0338         sys.stderr.write(f"doxygen execution failed: {e}\n")
0339 
0340 
0341 def prepare(app):
0342     with open(DIR.parent / "README.rst") as f:
0343         contents = f.read()
0344 
0345     if app.builder.name == "latex":
0346         # Remove badges and stuff from start
0347         contents = contents[contents.find(r".. start") :]
0348 
0349         # Filter out section titles for index.rst for LaTeX
0350         contents = re.sub(r"^(.*)\n[-~]{3,}$", r"**\1**", contents, flags=re.MULTILINE)
0351 
0352     with open(DIR / "readme.rst", "w") as f:
0353         f.write(contents)
0354 
0355 
0356 def clean_up(app, exception):
0357     (DIR / "readme.rst").unlink()
0358 
0359 
0360 def setup(app):
0361 
0362     # Add hook for building doxygen xml when needed
0363     app.connect("builder-inited", generate_doxygen_xml)
0364 
0365     # Copy the readme in
0366     app.connect("builder-inited", prepare)
0367 
0368     # Clean up the generated readme
0369     app.connect("build-finished", clean_up)