Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | # |
| 3 | # Python documentation build configuration file |
| 4 | # |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 5 | # This file is execfile()d with the current directory set to its containing dir. |
| 6 | # |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 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). |
Georg Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 9 | |
Georg Brandl | dd76e05 | 2008-01-21 20:20:53 +0000 | [diff] [blame] | 10 | import sys, os, time |
Georg Brandl | 160cbce | 2014-10-29 08:41:02 +0100 | [diff] [blame] | 11 | sys.path.append(os.path.abspath('tools/extensions')) |
Georg Brandl | dd76e05 | 2008-01-21 20:20:53 +0000 | [diff] [blame] | 12 | |
Georg Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 13 | # General configuration |
| 14 | # --------------------- |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 15 | |
Benjamin Peterson | 342fd18 | 2014-09-05 10:03:26 -0400 | [diff] [blame] | 16 | extensions = ['sphinx.ext.coverage', 'sphinx.ext.doctest', |
| 17 | 'pyspecific', 'c_annotations'] |
Georg Brandl | 56eadd9 | 2008-01-27 20:25:12 +0000 | [diff] [blame] | 18 | |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 19 | # General substitutions. |
| 20 | project = 'Python' |
Georg Brandl | dd76e05 | 2008-01-21 20:20:53 +0000 | [diff] [blame] | 21 | copyright = '1990-%s, Python Software Foundation' % time.strftime('%Y') |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 22 | |
Georg Brandl | dd76e05 | 2008-01-21 20:20:53 +0000 | [diff] [blame] | 23 | # We look for the Include/patchlevel.h file in the current Python source tree |
| 24 | # and replace the values accordingly. |
| 25 | import patchlevel |
| 26 | version, release = patchlevel.get_version_info() |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 27 | |
| 28 | # There are two options for replacing |today|: either, you set today to some |
| 29 | # non-false value, then it is used: |
| 30 | today = '' |
| 31 | # Else, today_fmt is used as the format for a strftime call. |
| 32 | today_fmt = '%B %d, %Y' |
| 33 | |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 34 | # List of files that shouldn't be included in the build. |
Georg Brandl | 3e46d7c | 2014-09-21 00:42:40 +0200 | [diff] [blame] | 35 | exclude_patterns = [ |
| 36 | 'maclib/scrap.rst', |
| 37 | 'library/xmllib.rst', |
| 38 | 'library/xml.etree.rst', |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 39 | ] |
| 40 | |
Georg Brandl | 14b5a4d | 2014-10-02 08:26:26 +0200 | [diff] [blame] | 41 | # Require Sphinx 1.2 for build. |
| 42 | needs_sphinx = '1.2' |
| 43 | |
Georg Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 44 | |
| 45 | # Options for HTML output |
| 46 | # ----------------------- |
| 47 | |
Georg Brandl | 27a4918 | 2012-01-21 08:58:22 +0100 | [diff] [blame] | 48 | html_theme = 'default' |
| 49 | html_theme_options = {'collapsiblesidebar': True} |
| 50 | |
Georg Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 51 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, |
| 52 | # using the given strftime format. |
| 53 | html_last_updated_fmt = '%b %d, %Y' |
| 54 | |
Georg Brandl | 160cbce | 2014-10-29 08:41:02 +0100 | [diff] [blame] | 55 | # Path to find HTML templates. |
| 56 | templates_path = ['tools/templates'] |
Georg Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 57 | |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 58 | # Custom sidebar templates, filenames relative to this file. |
| 59 | html_sidebars = { |
Georg Brandl | 5bb647d | 2008-03-09 18:18:30 +0000 | [diff] [blame] | 60 | 'index': 'indexsidebar.html', |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 61 | } |
| 62 | |
| 63 | # Additional templates that should be rendered to pages. |
| 64 | html_additional_pages = { |
Georg Brandl | 5bb647d | 2008-03-09 18:18:30 +0000 | [diff] [blame] | 65 | 'download': 'download.html', |
Georg Brandl | 1df986b | 2008-04-19 21:28:38 +0000 | [diff] [blame] | 66 | 'index': 'indexcontent.html', |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 67 | } |
| 68 | |
Georg Brandl | 4f1f36b | 2008-04-27 20:03:05 +0000 | [diff] [blame] | 69 | # Output an OpenSearch description file. |
Georg Brandl | 27a4918 | 2012-01-21 08:58:22 +0100 | [diff] [blame] | 70 | html_use_opensearch = 'http://docs.python.org/' |
Georg Brandl | 4f1f36b | 2008-04-27 20:03:05 +0000 | [diff] [blame] | 71 | |
| 72 | # Additional static files. |
Georg Brandl | f16fbf9 | 2014-09-30 22:51:30 +0200 | [diff] [blame] | 73 | html_static_path = ['tools/static'] |
Georg Brandl | 4f1f36b | 2008-04-27 20:03:05 +0000 | [diff] [blame] | 74 | |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 75 | # Output file base name for HTML help builder. |
Georg Brandl | 47dff40 | 2008-03-02 06:45:40 +0000 | [diff] [blame] | 76 | htmlhelp_basename = 'python' + release.replace('.', '') |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 77 | |
Georg Brandl | 5c15aba | 2008-06-17 09:01:35 +0000 | [diff] [blame] | 78 | # Split the index |
| 79 | html_split_index = True |
| 80 | |
Georg Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 81 | |
| 82 | # Options for LaTeX output |
| 83 | # ------------------------ |
| 84 | |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 85 | # The paper size ('letter' or 'a4'). |
| 86 | latex_paper_size = 'a4' |
Georg Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 87 | |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 88 | # The font size ('10pt', '11pt' or '12pt'). |
| 89 | latex_font_size = '10pt' |
| 90 | |
| 91 | # Grouping the document tree into LaTeX files. List of tuples |
| 92 | # (source start file, target name, title, author, document class [howto/manual]). |
Georg Brandl | ecc0cc0 | 2014-10-29 08:14:04 +0100 | [diff] [blame^] | 93 | _stdauthor = r'Guido van Rossum\\and the Python development team' |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 94 | latex_documents = [ |
Georg Brandl | a51f61b | 2008-02-01 20:45:33 +0000 | [diff] [blame] | 95 | ('c-api/index', 'c-api.tex', |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 96 | 'The Python/C API', _stdauthor, 'manual'), |
Georg Brandl | a51f61b | 2008-02-01 20:45:33 +0000 | [diff] [blame] | 97 | ('distutils/index', 'distutils.tex', |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 98 | 'Distributing Python Modules', _stdauthor, 'manual'), |
Georg Brandl | a51f61b | 2008-02-01 20:45:33 +0000 | [diff] [blame] | 99 | ('extending/index', 'extending.tex', |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 100 | 'Extending and Embedding Python', _stdauthor, 'manual'), |
Georg Brandl | a51f61b | 2008-02-01 20:45:33 +0000 | [diff] [blame] | 101 | ('install/index', 'install.tex', |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 102 | 'Installing Python Modules', _stdauthor, 'manual'), |
Georg Brandl | a51f61b | 2008-02-01 20:45:33 +0000 | [diff] [blame] | 103 | ('library/index', 'library.tex', |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 104 | 'The Python Library Reference', _stdauthor, 'manual'), |
Georg Brandl | a51f61b | 2008-02-01 20:45:33 +0000 | [diff] [blame] | 105 | ('reference/index', 'reference.tex', |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 106 | 'The Python Language Reference', _stdauthor, 'manual'), |
Georg Brandl | a51f61b | 2008-02-01 20:45:33 +0000 | [diff] [blame] | 107 | ('tutorial/index', 'tutorial.tex', |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 108 | 'Python Tutorial', _stdauthor, 'manual'), |
Georg Brandl | a51f61b | 2008-02-01 20:45:33 +0000 | [diff] [blame] | 109 | ('using/index', 'using.tex', |
Georg Brandl | 21946af | 2010-10-06 09:28:45 +0000 | [diff] [blame] | 110 | 'Python Setup and Usage', _stdauthor, 'manual'), |
Georg Brandl | 3b85b9b | 2010-11-26 08:20:18 +0000 | [diff] [blame] | 111 | ('faq/index', 'faq.tex', |
| 112 | 'Python Frequently Asked Questions', _stdauthor, 'manual'), |
Georg Brandl | a51f61b | 2008-02-01 20:45:33 +0000 | [diff] [blame] | 113 | ('whatsnew/' + version, 'whatsnew.tex', |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 114 | 'What\'s New in Python', 'A. M. Kuchling', 'howto'), |
| 115 | ] |
| 116 | # Collect all HOWTOs individually |
Georg Brandl | a51f61b | 2008-02-01 20:45:33 +0000 | [diff] [blame] | 117 | latex_documents.extend(('howto/' + fn[:-4], 'howto-' + fn[:-4] + '.tex', |
Georg Brandl | 012a1ff | 2008-11-08 11:47:44 +0000 | [diff] [blame] | 118 | '', _stdauthor, 'howto') |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 119 | for fn in os.listdir('howto') |
| 120 | if fn.endswith('.rst') and fn != 'index.rst') |
| 121 | |
| 122 | # Additional stuff for the LaTeX preamble. |
| 123 | latex_preamble = r''' |
| 124 | \authoraddress{ |
| 125 | \strong{Python Software Foundation}\\ |
| 126 | Email: \email{docs@python.org} |
| 127 | } |
Georg Brandl | 65e8fc7 | 2008-11-19 07:59:09 +0000 | [diff] [blame] | 128 | \let\Verbatim=\OriginalVerbatim |
| 129 | \let\endVerbatim=\endOriginalVerbatim |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 130 | ''' |
| 131 | |
| 132 | # Documents to append as an appendix to all manuals. |
Georg Brandl | a51f61b | 2008-02-01 20:45:33 +0000 | [diff] [blame] | 133 | latex_appendices = ['glossary', 'about', 'license', 'copyright'] |
Georg Brandl | 1704828 | 2008-02-23 18:47:04 +0000 | [diff] [blame] | 134 | |
Benjamin Peterson | 626c0aa | 2009-08-24 17:42:36 +0000 | [diff] [blame] | 135 | # Get LaTeX to handle Unicode correctly |
Georg Brandl | 27a4918 | 2012-01-21 08:58:22 +0100 | [diff] [blame] | 136 | latex_elements = {'inputenc': r'\usepackage[utf8x]{inputenc}', 'utf8extra': ''} |
Benjamin Peterson | 626c0aa | 2009-08-24 17:42:36 +0000 | [diff] [blame] | 137 | |
Georg Brandl | 1704828 | 2008-02-23 18:47:04 +0000 | [diff] [blame] | 138 | # Options for the coverage checker |
| 139 | # -------------------------------- |
| 140 | |
| 141 | # The coverage checker will ignore all modules/functions/classes whose names |
| 142 | # match any of the following regexes (using re.match). |
| 143 | coverage_ignore_modules = [ |
| 144 | r'[T|t][k|K]', |
| 145 | r'Tix', |
| 146 | r'distutils.*', |
| 147 | ] |
| 148 | |
| 149 | coverage_ignore_functions = [ |
| 150 | 'test($|_)', |
| 151 | ] |
| 152 | |
| 153 | coverage_ignore_classes = [ |
| 154 | ] |
| 155 | |
| 156 | # Glob patterns for C source files for C API coverage, relative to this directory. |
| 157 | coverage_c_path = [ |
| 158 | '../Include/*.h', |
| 159 | ] |
| 160 | |
| 161 | # Regexes to find C items in the source files. |
| 162 | coverage_c_regexes = { |
| 163 | 'cfunction': (r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)'), |
| 164 | 'data': (r'^PyAPI_DATA\(.*\)\s+([^_][\w_]+)'), |
| 165 | 'macro': (r'^#define ([^_][\w_]+)\(.*\)[\s|\\]'), |
| 166 | } |
| 167 | |
| 168 | # The coverage checker will ignore all C items whose names match these regexes |
| 169 | # (using re.match) -- the keys must be the same as in coverage_c_regexes. |
| 170 | coverage_ignore_c_items = { |
| 171 | # 'cfunction': [...] |
| 172 | } |
Georg Brandl | 160cbce | 2014-10-29 08:41:02 +0100 | [diff] [blame] | 173 | |
| 174 | # Options for extensions |
| 175 | # ---------------------- |
| 176 | |
| 177 | # Relative filename of the reference count data file. |
| 178 | refcount_file = 'data/refcounts.dat' |