Blame external/pybind11/docs/conf.py

Packit 534379
#!/usr/bin/env python3
Packit 534379
# -*- coding: utf-8 -*-
Packit 534379
#
Packit 534379
# pybind11 documentation build configuration file, created by
Packit 534379
# sphinx-quickstart on Sun Oct 11 19:23:48 2015.
Packit 534379
#
Packit 534379
# This file is execfile()d with the current directory set to its
Packit 534379
# containing dir.
Packit 534379
#
Packit 534379
# Note that not all possible configuration values are present in this
Packit 534379
# autogenerated file.
Packit 534379
#
Packit 534379
# All configuration values have a default; values that are commented out
Packit 534379
# serve to show the default.
Packit 534379
Packit 534379
import sys
Packit 534379
import os
Packit 534379
import shlex
Packit 534379
import subprocess
Packit 534379
Packit 534379
# If extensions (or modules to document with autodoc) are in another directory,
Packit 534379
# add these directories to sys.path here. If the directory is relative to the
Packit 534379
# documentation root, use os.path.abspath to make it absolute, like shown here.
Packit 534379
#sys.path.insert(0, os.path.abspath('.'))
Packit 534379
Packit 534379
# -- General configuration ------------------------------------------------
Packit 534379
Packit 534379
# If your documentation needs a minimal Sphinx version, state it here.
Packit 534379
#needs_sphinx = '1.0'
Packit 534379
Packit 534379
# Add any Sphinx extension module names here, as strings. They can be
Packit 534379
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
Packit 534379
# ones.
Packit 534379
extensions = ['breathe']
Packit 534379
Packit 534379
breathe_projects = {'pybind11': '.build/doxygenxml/'}
Packit 534379
breathe_default_project = 'pybind11'
Packit 534379
breathe_domain_by_extension = {'h': 'cpp'}
Packit 534379
Packit 534379
# Add any paths that contain templates here, relative to this directory.
Packit 534379
templates_path = ['.templates']
Packit 534379
Packit 534379
# The suffix(es) of source filenames.
Packit 534379
# You can specify multiple suffix as a list of string:
Packit 534379
# source_suffix = ['.rst', '.md']
Packit 534379
source_suffix = '.rst'
Packit 534379
Packit 534379
# The encoding of source files.
Packit 534379
#source_encoding = 'utf-8-sig'
Packit 534379
Packit 534379
# The master toctree document.
Packit 534379
master_doc = 'index'
Packit 534379
Packit 534379
# General information about the project.
Packit 534379
project = 'pybind11'
Packit 534379
copyright = '2017, Wenzel Jakob'
Packit 534379
author = 'Wenzel Jakob'
Packit 534379
Packit 534379
# The version info for the project you're documenting, acts as replacement for
Packit 534379
# |version| and |release|, also used in various other places throughout the
Packit 534379
# built documents.
Packit 534379
#
Packit 534379
# The short X.Y version.
Packit 534379
version = '2.4'
Packit 534379
# The full version, including alpha/beta/rc tags.
Packit 534379
release = '2.4.3'
Packit 534379
Packit 534379
# The language for content autogenerated by Sphinx. Refer to documentation
Packit 534379
# for a list of supported languages.
Packit 534379
#
Packit 534379
# This is also used if you do content translation via gettext catalogs.
Packit 534379
# Usually you set "language" from the command line for these cases.
Packit 534379
language = None
Packit 534379
Packit 534379
# There are two options for replacing |today|: either, you set today to some
Packit 534379
# non-false value, then it is used:
Packit 534379
#today = ''
Packit 534379
# Else, today_fmt is used as the format for a strftime call.
Packit 534379
#today_fmt = '%B %d, %Y'
Packit 534379
Packit 534379
# List of patterns, relative to source directory, that match files and
Packit 534379
# directories to ignore when looking for source files.
Packit 534379
exclude_patterns = ['.build', 'release.rst']
Packit 534379
Packit 534379
# The reST default role (used for this markup: `text`) to use for all
Packit 534379
# documents.
Packit 534379
default_role = 'any'
Packit 534379
Packit 534379
# If true, '()' will be appended to :func: etc. cross-reference text.
Packit 534379
#add_function_parentheses = True
Packit 534379
Packit 534379
# If true, the current module name will be prepended to all description
Packit 534379
# unit titles (such as .. function::).
Packit 534379
#add_module_names = True
Packit 534379
Packit 534379
# If true, sectionauthor and moduleauthor directives will be shown in the
Packit 534379
# output. They are ignored by default.
Packit 534379
#show_authors = False
Packit 534379
Packit 534379
# The name of the Pygments (syntax highlighting) style to use.
Packit 534379
#pygments_style = 'monokai'
Packit 534379
Packit 534379
# A list of ignored prefixes for module index sorting.
Packit 534379
#modindex_common_prefix = []
Packit 534379
Packit 534379
# If true, keep warnings as "system message" paragraphs in the built documents.
Packit 534379
#keep_warnings = False
Packit 534379
Packit 534379
# If true, `todo` and `todoList` produce output, else they produce nothing.
Packit 534379
todo_include_todos = False
Packit 534379
Packit 534379
Packit 534379
# -- Options for HTML output ----------------------------------------------
Packit 534379
Packit 534379
# The theme to use for HTML and HTML Help pages.  See the documentation for
Packit 534379
# a list of builtin themes.
Packit 534379
Packit 534379
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
Packit 534379
Packit 534379
if not on_rtd:  # only import and set the theme if we're building docs locally
Packit 534379
    import sphinx_rtd_theme
Packit 534379
    html_theme = 'sphinx_rtd_theme'
Packit 534379
    html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
Packit 534379
Packit 534379
    html_context = {
Packit 534379
        'css_files': [
Packit 534379
            '_static/theme_overrides.css'
Packit 534379
        ]
Packit 534379
    }
Packit 534379
else:
Packit 534379
    html_context = {
Packit 534379
        'css_files': [
Packit 534379
            '//media.readthedocs.org/css/sphinx_rtd_theme.css',            
Packit 534379
            '//media.readthedocs.org/css/readthedocs-doc-embed.css',    
Packit 534379
            '_static/theme_overrides.css'
Packit 534379
        ]
Packit 534379
    }
Packit 534379
Packit 534379
# Theme options are theme-specific and customize the look and feel of a theme
Packit 534379
# further.  For a list of options available for each theme, see the
Packit 534379
# documentation.
Packit 534379
#html_theme_options = {}
Packit 534379
Packit 534379
# Add any paths that contain custom themes here, relative to this directory.
Packit 534379
#html_theme_path = []
Packit 534379
Packit 534379
# The name for this set of Sphinx documents.  If None, it defaults to
Packit 534379
# "<project> v<release> documentation".
Packit 534379
#html_title = None
Packit 534379
Packit 534379
# A shorter title for the navigation bar.  Default is the same as html_title.
Packit 534379
#html_short_title = None
Packit 534379
Packit 534379
# The name of an image file (relative to this directory) to place at the top
Packit 534379
# of the sidebar.
Packit 534379
#html_logo = None
Packit 534379
Packit 534379
# The name of an image file (within the static path) to use as favicon of the
Packit 534379
# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
Packit 534379
# pixels large.
Packit 534379
#html_favicon = None
Packit 534379
Packit 534379
# Add any paths that contain custom static files (such as style sheets) here,
Packit 534379
# relative to this directory. They are copied after the builtin static files,
Packit 534379
# so a file named "default.css" will overwrite the builtin "default.css".
Packit 534379
html_static_path = ['_static']
Packit 534379
Packit 534379
# Add any extra paths that contain custom files (such as robots.txt or
Packit 534379
# .htaccess) here, relative to this directory. These files are copied
Packit 534379
# directly to the root of the documentation.
Packit 534379
#html_extra_path = []
Packit 534379
Packit 534379
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
Packit 534379
# using the given strftime format.
Packit 534379
#html_last_updated_fmt = '%b %d, %Y'
Packit 534379
Packit 534379
# If true, SmartyPants will be used to convert quotes and dashes to
Packit 534379
# typographically correct entities.
Packit 534379
#html_use_smartypants = True
Packit 534379
Packit 534379
# Custom sidebar templates, maps document names to template names.
Packit 534379
#html_sidebars = {}
Packit 534379
Packit 534379
# Additional templates that should be rendered to pages, maps page names to
Packit 534379
# template names.
Packit 534379
#html_additional_pages = {}
Packit 534379
Packit 534379
# If false, no module index is generated.
Packit 534379
#html_domain_indices = True
Packit 534379
Packit 534379
# If false, no index is generated.
Packit 534379
#html_use_index = True
Packit 534379
Packit 534379
# If true, the index is split into individual pages for each letter.
Packit 534379
#html_split_index = False
Packit 534379
Packit 534379
# If true, links to the reST sources are added to the pages.
Packit 534379
#html_show_sourcelink = True
Packit 534379
Packit 534379
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
Packit 534379
#html_show_sphinx = True
Packit 534379
Packit 534379
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
Packit 534379
#html_show_copyright = True
Packit 534379
Packit 534379
# If true, an OpenSearch description file will be output, and all pages will
Packit 534379
# contain a <link> tag referring to it.  The value of this option must be the
Packit 534379
# base URL from which the finished HTML is served.
Packit 534379
#html_use_opensearch = ''
Packit 534379
Packit 534379
# This is the file name suffix for HTML files (e.g. ".xhtml").
Packit 534379
#html_file_suffix = None
Packit 534379
Packit 534379
# Language to be used for generating the HTML full-text search index.
Packit 534379
# Sphinx supports the following languages:
Packit 534379
#   'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
Packit 534379
#   'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
Packit 534379
#html_search_language = 'en'
Packit 534379
Packit 534379
# A dictionary with options for the search language support, empty by default.
Packit 534379
# Now only 'ja' uses this config value
Packit 534379
#html_search_options = {'type': 'default'}
Packit 534379
Packit 534379
# The name of a javascript file (relative to the configuration directory) that
Packit 534379
# implements a search results scorer. If empty, the default will be used.
Packit 534379
#html_search_scorer = 'scorer.js'
Packit 534379
Packit 534379
# Output file base name for HTML help builder.
Packit 534379
htmlhelp_basename = 'pybind11doc'
Packit 534379
Packit 534379
# -- Options for LaTeX output ---------------------------------------------
Packit 534379
Packit 534379
latex_elements = {
Packit 534379
# The paper size ('letterpaper' or 'a4paper').
Packit 534379
#'papersize': 'letterpaper',
Packit 534379
Packit 534379
# The font size ('10pt', '11pt' or '12pt').
Packit 534379
#'pointsize': '10pt',
Packit 534379
Packit 534379
# Additional stuff for the LaTeX preamble.
Packit 534379
'preamble': '\DeclareUnicodeCharacter{00A0}{}',
Packit 534379
Packit 534379
# Latex figure (float) alignment
Packit 534379
#'figure_align': 'htbp',
Packit 534379
}
Packit 534379
Packit 534379
# Grouping the document tree into LaTeX files. List of tuples
Packit 534379
# (source start file, target name, title,
Packit 534379
#  author, documentclass [howto, manual, or own class]).
Packit 534379
latex_documents = [
Packit 534379
  (master_doc, 'pybind11.tex', 'pybind11 Documentation',
Packit 534379
   'Wenzel Jakob', 'manual'),
Packit 534379
]
Packit 534379
Packit 534379
# The name of an image file (relative to this directory) to place at the top of
Packit 534379
# the title page.
Packit 534379
# latex_logo = 'pybind11-logo.png'
Packit 534379
Packit 534379
# For "manual" documents, if this is true, then toplevel headings are parts,
Packit 534379
# not chapters.
Packit 534379
#latex_use_parts = False
Packit 534379
Packit 534379
# If true, show page references after internal links.
Packit 534379
#latex_show_pagerefs = False
Packit 534379
Packit 534379
# If true, show URL addresses after external links.
Packit 534379
#latex_show_urls = False
Packit 534379
Packit 534379
# Documents to append as an appendix to all manuals.
Packit 534379
#latex_appendices = []
Packit 534379
Packit 534379
# If false, no module index is generated.
Packit 534379
#latex_domain_indices = True
Packit 534379
Packit 534379
Packit 534379
# -- Options for manual page output ---------------------------------------
Packit 534379
Packit 534379
# One entry per manual page. List of tuples
Packit 534379
# (source start file, name, description, authors, manual section).
Packit 534379
man_pages = [
Packit 534379
    (master_doc, 'pybind11', 'pybind11 Documentation',
Packit 534379
     [author], 1)
Packit 534379
]
Packit 534379
Packit 534379
# If true, show URL addresses after external links.
Packit 534379
#man_show_urls = False
Packit 534379
Packit 534379
Packit 534379
# -- Options for Texinfo output -------------------------------------------
Packit 534379
Packit 534379
# Grouping the document tree into Texinfo files. List of tuples
Packit 534379
# (source start file, target name, title, author,
Packit 534379
#  dir menu entry, description, category)
Packit 534379
texinfo_documents = [
Packit 534379
  (master_doc, 'pybind11', 'pybind11 Documentation',
Packit 534379
   author, 'pybind11', 'One line description of project.',
Packit 534379
   'Miscellaneous'),
Packit 534379
]
Packit 534379
Packit 534379
# Documents to append as an appendix to all manuals.
Packit 534379
#texinfo_appendices = []
Packit 534379
Packit 534379
# If false, no module index is generated.
Packit 534379
#texinfo_domain_indices = True
Packit 534379
Packit 534379
# How to display URL addresses: 'footnote', 'no', or 'inline'.
Packit 534379
#texinfo_show_urls = 'footnote'
Packit 534379
Packit 534379
# If true, do not generate a @detailmenu in the "Top" node's menu.
Packit 534379
#texinfo_no_detailmenu = False
Packit 534379
Packit 534379
primary_domain = 'cpp'
Packit 534379
highlight_language = 'cpp'
Packit 534379
Packit 534379
Packit 534379
def generate_doxygen_xml(app):
Packit 534379
    build_dir = os.path.join(app.confdir, '.build')
Packit 534379
    if not os.path.exists(build_dir):
Packit 534379
        os.mkdir(build_dir)
Packit 534379
Packit 534379
    try:
Packit 534379
        subprocess.call(['doxygen', '--version'])
Packit 534379
        retcode = subprocess.call(['doxygen'], cwd=app.confdir)
Packit 534379
        if retcode < 0:
Packit 534379
            sys.stderr.write("doxygen error code: {}\n".format(-retcode))
Packit 534379
    except OSError as e:
Packit 534379
        sys.stderr.write("doxygen execution failed: {}\n".format(e))
Packit 534379
Packit 534379
Packit 534379
def setup(app):
Packit 534379
    """Add hook for building doxygen xml when needed"""
Packit 534379
    app.connect("builder-inited", generate_doxygen_xml)