1# -*- coding: utf-8 -*-
2#
3# pyOpenSSL documentation build configuration file, created by
4# sphinx-quickstart on Sat Jul 16 07:12:22 2011.
5#
6# This file is execfile()d with the current directory set to its parent dir.
7#
8# Note that not all possible configuration values are present in this
9# autogenerated file.
10#
11# All configuration values have a default; values that are commented out
12# serve to show the default.
13
14import codecs
15import os
16import re
17import sys
18
19
20HERE = os.path.abspath(os.path.dirname(__file__))
21
22
23def read_file(*parts):
24    """
25    Build an absolute path from *parts* and return the contents of the
26    resulting file.  Assume UTF-8 encoding.
27    """
28    with codecs.open(os.path.join(HERE, *parts), "rb", "ascii") as f:
29        return f.read()
30
31
32def find_version(*file_paths):
33    version_file = read_file(*file_paths)
34    version_match = re.search(
35        r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M
36    )
37    if version_match:
38        return version_match.group(1)
39    raise RuntimeError("Unable to find version string.")
40
41
42DOC_DIR = os.path.abspath(os.path.dirname(__file__))
43sys.path.insert(0, os.path.abspath(os.path.join(DOC_DIR, "..")))
44
45# If extensions (or modules to document with autodoc) are in another directory,
46# add these directories to sys.path here. If the directory is relative to the
47# documentation root, use os.path.abspath to make it absolute, like shown here.
48# sys.path.insert(0, os.path.abspath('.'))
49
50# -- General configuration ----------------------------------------------------
51
52# If your documentation needs a minimal Sphinx version, state it here.
53needs_sphinx = "1.0"
54
55# Add any Sphinx extension module names here, as strings. They can be
56# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
57extensions = [
58    "sphinx.ext.autodoc",
59    "sphinx.ext.intersphinx",
60]
61
62# Add any paths that contain templates here, relative to this directory.
63templates_path = ["_templates"]
64
65# The suffix of source filenames.
66source_suffix = ".rst"
67
68# The encoding of source files.
69# source_encoding = 'utf-8-sig'
70
71# The master toctree document.
72master_doc = "index"
73
74# General information about the project.
75project = u"pyOpenSSL"
76authors = u"The pyOpenSSL developers"
77copyright = u"2001 " + authors
78
79# The version info for the project you're documenting, acts as replacement for
80# |version| and |release|, also used in various other places throughout the
81# built documents.
82#
83# The short X.Y version.
84version = find_version("..", "src", "OpenSSL", "version.py")
85# The full version, including alpha/beta/rc tags.
86release = version
87
88# The language for content autogenerated by Sphinx. Refer to documentation
89# for a list of supported languages.
90# language = None
91
92# There are two options for replacing |today|: either, you set today to some
93# non-false value, then it is used:
94# today = ''
95# Else, today_fmt is used as the format for a strftime call.
96# today_fmt = '%B %d, %Y'
97
98# List of patterns, relative to source directory, that match files and
99# directories to ignore when looking for source files.
100exclude_patterns = ["_build"]
101
102# The reST default role (used for this markup `text`) to use for all documents.
103# default_role = None
104
105# If true, '()' will be appended to :func: etc. cross-reference text.
106# add_function_parentheses = True
107
108# If true, the current module name will be prepended to all description
109# unit titles (such as .. function::).
110# add_module_names = True
111
112# If true, sectionauthor and moduleauthor directives will be shown in the
113# output. They are ignored by default.
114# show_authors = False
115
116# The name of the Pygments (syntax highlighting) style to use.
117pygments_style = "sphinx"
118
119# A list of ignored prefixes for module index sorting.
120# modindex_common_prefix = []
121
122
123# -- Options for HTML output --------------------------------------------------
124
125# The theme to use for HTML and HTML Help pages.  See the documentation for
126# a list of builtin themes.
127on_rtd = os.environ.get("READTHEDOCS", None) == "True"
128
129if not on_rtd:  # only import and set the theme if we're building docs locally
130    import sphinx_rtd_theme
131
132    html_theme = "sphinx_rtd_theme"
133    html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
134
135# Theme options are theme-specific and customize the look and feel of a theme
136# further.  For a list of options available for each theme, see the
137# documentation.
138# html_theme_options = {}
139
140# Add any paths that contain custom themes here, relative to this directory.
141# html_theme_path = []
142
143# The name for this set of Sphinx documents.  If None, it defaults to
144# "<project> v<release> documentation".
145# html_title = None
146
147# A shorter title for the navigation bar.  Default is the same as html_title.
148# html_short_title = None
149
150# The name of an image file (relative to this directory) to place at the top
151# of the sidebar.
152# html_logo = None
153
154# The name of an image file (within the static path) to use as favicon of the
155# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
156# pixels large.
157# html_favicon = None
158
159# Add any paths that contain custom static files (such as style sheets) here,
160# relative to this directory. They are copied after the builtin static files,
161# so a file named "default.css" will overwrite the builtin "default.css".
162# html_static_path = ['_static']
163
164# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
165# using the given strftime format.
166# html_last_updated_fmt = '%b %d, %Y'
167
168# If true, SmartyPants will be used to convert quotes and dashes to
169# typographically correct entities.
170# html_use_smartypants = True
171
172# Custom sidebar templates, maps document names to template names.
173# html_sidebars = {}
174
175# Additional templates that should be rendered to pages, maps page names to
176# template names.
177# html_additional_pages = {}
178
179# If false, no module index is generated.
180# html_domain_indices = True
181
182# If false, no index is generated.
183# html_use_index = True
184
185# If true, the index is split into individual pages for each letter.
186# html_split_index = False
187
188# If true, links to the reST sources are added to the pages.
189# html_show_sourcelink = True
190
191# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
192# html_show_sphinx = True
193
194# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
195# html_show_copyright = True
196
197# If true, an OpenSearch description file will be output, and all pages will
198# contain a <link> tag referring to it.  The value of this option must be the
199# base URL from which the finished HTML is served.
200# html_use_opensearch = ''
201
202# This is the file name suffix for HTML files (e.g. ".xhtml").
203# html_file_suffix = None
204
205# Output file base name for HTML help builder.
206htmlhelp_basename = "pyOpenSSLdoc"
207
208
209# -- Options for LaTeX output -------------------------------------------------
210
211# The paper size ('letter' or 'a4').
212# latex_paper_size = 'letter'
213
214# The font size ('10pt', '11pt' or '12pt').
215# latex_font_size = '10pt'
216
217# Grouping the document tree into LaTeX files. List of tuples
218# (source start file, target name, title, author, documentclass [howto/manual])
219latex_documents = [
220    ("index", "pyOpenSSL.tex", u"pyOpenSSL Documentation", authors, "manual"),
221]
222
223# The name of an image file (relative to this directory) to place at the top of
224# the title page.
225# latex_logo = None
226
227# For "manual" documents, if this is true, then toplevel headings are parts,
228# not chapters.
229# latex_use_parts = False
230
231# If true, show page references after internal links.
232# latex_show_pagerefs = False
233
234# If true, show URL addresses after external links.
235# latex_show_urls = False
236
237# Additional stuff for the LaTeX preamble.
238# latex_preamble = ''
239
240# Documents to append as an appendix to all manuals.
241# latex_appendices = []
242
243# If false, no module index is generated.
244# latex_domain_indices = True
245
246
247# -- Options for manual page output -------------------------------------------
248
249# One entry per manual page. List of tuples
250# (source start file, name, description, authors, manual section).
251man_pages = [("index", "pyopenssl", u"pyOpenSSL Documentation", [authors], 1)]
252
253intersphinx_mapping = {
254    "https://docs.python.org/3": None,
255    "https://cryptography.io/en/latest/": None,
256}
257