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