1# -*- coding: utf-8 -*-
2#
3# Python documentation build configuration file
4#
5# This file is execfile()d with the current directory set to its containing dir.
6#
7# The contents of this file are pickled, so don't put values in the namespace
8# that aren't pickleable (module imports are okay, they're removed automatically).
9
10import sys, os, time
11sys.path.append(os.path.abspath('tools/extensions'))
12
13# General configuration
14# ---------------------
15
16extensions = ['sphinx.ext.coverage', 'sphinx.ext.doctest',
17              'pyspecific', 'c_annotations']
18
19# General substitutions.
20project = 'Python'
21copyright = '1990-%s, Python Software Foundation' % time.strftime('%Y')
22
23# We look for the Include/patchlevel.h file in the current Python source tree
24# and replace the values accordingly.
25import patchlevel
26version, release = patchlevel.get_version_info()
27
28# There are two options for replacing |today|: either, you set today to some
29# non-false value, then it is used:
30today = ''
31# Else, today_fmt is used as the format for a strftime call.
32today_fmt = '%B %d, %Y'
33
34# List of files that shouldn't be included in the build.
35exclude_patterns = [
36    'maclib/scrap.rst',
37    'library/xmllib.rst',
38    'library/xml.etree.rst',
39]
40
41# Require Sphinx 1.2 for build.
42needs_sphinx = '1.2'
43
44
45# Options for HTML output
46# -----------------------
47
48html_theme = 'default'
49html_theme_options = {'collapsiblesidebar': True}
50
51# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
52# using the given strftime format.
53html_last_updated_fmt = '%b %d, %Y'
54
55# Path to find HTML templates.
56templates_path = ['tools/templates']
57
58# Custom sidebar templates, filenames relative to this file.
59html_sidebars = {
60    'index': 'indexsidebar.html',
61}
62
63# Additional templates that should be rendered to pages.
64html_additional_pages = {
65    'download': 'download.html',
66    'index': 'indexcontent.html',
67}
68
69# Output an OpenSearch description file.
70html_use_opensearch = 'https://docs.python.org/'
71
72# Additional static files.
73html_static_path = ['tools/static']
74
75# Output file base name for HTML help builder.
76htmlhelp_basename = 'python' + release.replace('.', '')
77
78# Split the index
79html_split_index = True
80
81
82# Options for LaTeX output
83# ------------------------
84
85# Get LaTeX to handle Unicode correctly
86latex_elements = {
87    'inputenc': r'\usepackage[utf8x]{inputenc}',
88    'utf8extra': '',
89    'fontenc': r'\usepackage[T1,T2A]{fontenc}',
90}
91
92# Additional stuff for the LaTeX preamble.
93latex_elements['preamble'] = r'''
94\authoraddress{
95  \sphinxstrong{Python Software Foundation}\\
96  Email: \sphinxemail{docs@python.org}
97}
98\let\Verbatim=\OriginalVerbatim
99\let\endVerbatim=\endOriginalVerbatim
100'''
101
102# The paper size ('letter' or 'a4').
103latex_elements['papersize'] = 'a4'
104
105# The font size ('10pt', '11pt' or '12pt').
106latex_elements['pointsize'] = '10pt'
107
108# Grouping the document tree into LaTeX files. List of tuples
109# (source start file, target name, title, author, document class [howto/manual]).
110_stdauthor = r'Guido van Rossum\\and the Python development team'
111latex_documents = [
112    ('c-api/index', 'c-api.tex',
113     'The Python/C API', _stdauthor, 'manual'),
114    ('distributing/index', 'distributing.tex',
115     'Distributing Python Modules', _stdauthor, 'manual'),
116    ('extending/index', 'extending.tex',
117     'Extending and Embedding Python', _stdauthor, 'manual'),
118    ('installing/index', 'installing.tex',
119     'Installing Python Modules', _stdauthor, 'manual'),
120    ('library/index', 'library.tex',
121     'The Python Library Reference', _stdauthor, 'manual'),
122    ('reference/index', 'reference.tex',
123     'The Python Language Reference', _stdauthor, 'manual'),
124    ('tutorial/index', 'tutorial.tex',
125     'Python Tutorial', _stdauthor, 'manual'),
126    ('using/index', 'using.tex',
127     'Python Setup and Usage', _stdauthor, 'manual'),
128    ('faq/index', 'faq.tex',
129     'Python Frequently Asked Questions', _stdauthor, 'manual'),
130    ('whatsnew/' + version, 'whatsnew.tex',
131     'What\'s New in Python', 'A. M. Kuchling', 'howto'),
132]
133# Collect all HOWTOs individually
134latex_documents.extend(('howto/' + fn[:-4], 'howto-' + fn[:-4] + '.tex',
135                        '', _stdauthor, 'howto')
136                       for fn in os.listdir('howto')
137                       if fn.endswith('.rst') and fn != 'index.rst')
138
139# Documents to append as an appendix to all manuals.
140latex_appendices = ['glossary', 'about', 'license', 'copyright']
141
142# Options for Epub output
143# -----------------------
144
145epub_author = 'Python Documentation Authors'
146epub_publisher = 'Python Software Foundation'
147
148# Options for the coverage checker
149# --------------------------------
150
151# The coverage checker will ignore all modules/functions/classes whose names
152# match any of the following regexes (using re.match).
153coverage_ignore_modules = [
154    r'[T|t][k|K]',
155    r'Tix',
156    r'distutils.*',
157]
158
159coverage_ignore_functions = [
160    'test($|_)',
161]
162
163coverage_ignore_classes = [
164]
165
166# Glob patterns for C source files for C API coverage, relative to this directory.
167coverage_c_path = [
168    '../Include/*.h',
169]
170
171# Regexes to find C items in the source files.
172coverage_c_regexes = {
173    'cfunction': (r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)'),
174    'data': (r'^PyAPI_DATA\(.*\)\s+([^_][\w_]+)'),
175    'macro': (r'^#define ([^_][\w_]+)\(.*\)[\s|\\]'),
176}
177
178# The coverage checker will ignore all C items whose names match these regexes
179# (using re.match) -- the keys must be the same as in coverage_c_regexes.
180coverage_ignore_c_items = {
181#    'cfunction': [...]
182}
183
184
185# Options for the link checker
186# ----------------------------
187
188# Ignore certain URLs.
189linkcheck_ignore = [r'https://bugs.python.org/(issue)?\d+',
190                    # Ignore PEPs for now, they all have permanent redirects.
191                    r'http://www.python.org/dev/peps/pep-\d+']
192
193
194# Options for extensions
195# ----------------------
196
197# Relative filename of the reference count data file.
198refcount_file = 'data/refcounts.dat'
199