|
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 |
|
10 import sys, os, time |
|
11 sys.path.append(os.path.abspath('tools/sphinxext')) |
|
12 |
|
13 # General configuration |
|
14 # --------------------- |
|
15 |
|
16 extensions = ['sphinx.ext.refcounting', 'sphinx.ext.coverage', |
|
17 'sphinx.ext.doctest', 'pyspecific'] |
|
18 templates_path = ['tools/sphinxext'] |
|
19 |
|
20 # General substitutions. |
|
21 project = 'Python' |
|
22 copyright = '1990-%s, Python Software Foundation' % time.strftime('%Y') |
|
23 |
|
24 # The default replacements for |version| and |release|. |
|
25 # |
|
26 # The short X.Y version. |
|
27 # version = '2.6' |
|
28 # The full version, including alpha/beta/rc tags. |
|
29 # release = '2.6a0' |
|
30 |
|
31 # We look for the Include/patchlevel.h file in the current Python source tree |
|
32 # and replace the values accordingly. |
|
33 import patchlevel |
|
34 version, release = patchlevel.get_version_info() |
|
35 |
|
36 # There are two options for replacing |today|: either, you set today to some |
|
37 # non-false value, then it is used: |
|
38 today = '' |
|
39 # Else, today_fmt is used as the format for a strftime call. |
|
40 today_fmt = '%B %d, %Y' |
|
41 |
|
42 # List of files that shouldn't be included in the build. |
|
43 unused_docs = [ |
|
44 'maclib/scrap', |
|
45 'library/xmllib', |
|
46 'library/xml.etree', |
|
47 ] |
|
48 |
|
49 # Relative filename of the reference count data file. |
|
50 refcount_file = 'data/refcounts.dat' |
|
51 |
|
52 # If true, '()' will be appended to :func: etc. cross-reference text. |
|
53 add_function_parentheses = True |
|
54 |
|
55 # If true, the current module name will be prepended to all description |
|
56 # unit titles (such as .. function::). |
|
57 add_module_names = True |
|
58 |
|
59 |
|
60 # Options for HTML output |
|
61 # ----------------------- |
|
62 |
|
63 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, |
|
64 # using the given strftime format. |
|
65 html_last_updated_fmt = '%b %d, %Y' |
|
66 |
|
67 # If true, SmartyPants will be used to convert quotes and dashes to |
|
68 # typographically correct entities. |
|
69 html_use_smartypants = True |
|
70 |
|
71 # Custom sidebar templates, filenames relative to this file. |
|
72 html_sidebars = { |
|
73 'index': 'indexsidebar.html', |
|
74 } |
|
75 |
|
76 # Additional templates that should be rendered to pages. |
|
77 html_additional_pages = { |
|
78 'download': 'download.html', |
|
79 'index': 'indexcontent.html', |
|
80 } |
|
81 |
|
82 # Output an OpenSearch description file. |
|
83 html_use_opensearch = 'http://docs.python.org/dev' |
|
84 |
|
85 # Additional static files. |
|
86 html_static_path = ['tools/sphinxext/static'] |
|
87 |
|
88 # Output file base name for HTML help builder. |
|
89 htmlhelp_basename = 'python' + release.replace('.', '') |
|
90 |
|
91 # Split the index |
|
92 html_split_index = True |
|
93 |
|
94 |
|
95 # Options for LaTeX output |
|
96 # ------------------------ |
|
97 |
|
98 # The paper size ('letter' or 'a4'). |
|
99 latex_paper_size = 'a4' |
|
100 |
|
101 # The font size ('10pt', '11pt' or '12pt'). |
|
102 latex_font_size = '10pt' |
|
103 |
|
104 # Grouping the document tree into LaTeX files. List of tuples |
|
105 # (source start file, target name, title, author, document class [howto/manual]). |
|
106 _stdauthor = r'Guido van Rossum\\Fred L. Drake, Jr., editor' |
|
107 latex_documents = [ |
|
108 ('c-api/index', 'c-api.tex', |
|
109 'The Python/C API', _stdauthor, 'manual'), |
|
110 ('distutils/index', 'distutils.tex', |
|
111 'Distributing Python Modules', _stdauthor, 'manual'), |
|
112 ('documenting/index', 'documenting.tex', |
|
113 'Documenting Python', 'Georg Brandl', 'manual'), |
|
114 ('extending/index', 'extending.tex', |
|
115 'Extending and Embedding Python', _stdauthor, 'manual'), |
|
116 ('install/index', 'install.tex', |
|
117 'Installing Python Modules', _stdauthor, 'manual'), |
|
118 ('library/index', 'library.tex', |
|
119 'The Python Library Reference', _stdauthor, 'manual'), |
|
120 ('reference/index', 'reference.tex', |
|
121 'The Python Language Reference', _stdauthor, 'manual'), |
|
122 ('tutorial/index', 'tutorial.tex', |
|
123 'Python Tutorial', _stdauthor, 'manual'), |
|
124 ('using/index', 'using.tex', |
|
125 'Using Python', _stdauthor, 'manual'), |
|
126 ('whatsnew/' + version, 'whatsnew.tex', |
|
127 'What\'s New in Python', 'A. M. Kuchling', 'howto'), |
|
128 ] |
|
129 # Collect all HOWTOs individually |
|
130 latex_documents.extend(('howto/' + fn[:-4], 'howto-' + fn[:-4] + '.tex', |
|
131 'HOWTO', _stdauthor, 'howto') |
|
132 for fn in os.listdir('howto') |
|
133 if fn.endswith('.rst') and fn != 'index.rst') |
|
134 |
|
135 # Additional stuff for the LaTeX preamble. |
|
136 latex_preamble = r''' |
|
137 \authoraddress{ |
|
138 \strong{Python Software Foundation}\\ |
|
139 Email: \email{docs@python.org} |
|
140 } |
|
141 \let\Verbatim=\OriginalVerbatim |
|
142 \let\endVerbatim=\endOriginalVerbatim |
|
143 ''' |
|
144 |
|
145 # Documents to append as an appendix to all manuals. |
|
146 latex_appendices = ['glossary', 'about', 'license', 'copyright'] |
|
147 |
|
148 latex_elements = {'inputenc': '\\usepackage[utf8x]{inputenc}'} |
|
149 |
|
150 # Options for the coverage checker |
|
151 # -------------------------------- |
|
152 |
|
153 # The coverage checker will ignore all modules/functions/classes whose names |
|
154 # match any of the following regexes (using re.match). |
|
155 coverage_ignore_modules = [ |
|
156 r'[T|t][k|K]', |
|
157 r'Tix', |
|
158 r'distutils.*', |
|
159 ] |
|
160 |
|
161 coverage_ignore_functions = [ |
|
162 'test($|_)', |
|
163 ] |
|
164 |
|
165 coverage_ignore_classes = [ |
|
166 ] |
|
167 |
|
168 # Glob patterns for C source files for C API coverage, relative to this directory. |
|
169 coverage_c_path = [ |
|
170 '../Include/*.h', |
|
171 ] |
|
172 |
|
173 # Regexes to find C items in the source files. |
|
174 coverage_c_regexes = { |
|
175 'cfunction': (r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)'), |
|
176 'data': (r'^PyAPI_DATA\(.*\)\s+([^_][\w_]+)'), |
|
177 'macro': (r'^#define ([^_][\w_]+)\(.*\)[\s|\\]'), |
|
178 } |
|
179 |
|
180 # The coverage checker will ignore all C items whose names match these regexes |
|
181 # (using re.match) -- the keys must be the same as in coverage_c_regexes. |
|
182 coverage_ignore_c_items = { |
|
183 # 'cfunction': [...] |
|
184 } |