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