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