pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/commit/90d76ca7657566825daf8e5b22ab011f70439769

ylesheet" href="https://github.githubassets.com/assets/global-d18f184ea1a06a2c.css" /> Closes #21431: make docs depend on Sphinx 1.2 and fix pydoc-topics bu… · python/cpython@90d76ca · GitHub
Skip to content

Commit 90d76ca

Browse files
committed
Closes #21431: make docs depend on Sphinx 1.2 and fix pydoc-topics builder to
return Unicode strings on Python 3.
1 parent 2887f76 commit 90d76ca

2 files changed

Lines changed: 7 additions & 27 deletions

File tree

Doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
# By default, highlight as Python 3.
6262
highlight_language = 'python3'
6363

64-
needs_sphinx = '1.1'
64+
needs_sphinx = '1.2'
6565

6666

6767
# Options for HTML output

Doc/tools/sphinxext/pyspecific.py

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@
1414

1515
from docutils import nodes, utils
1616

17-
import sphinx
1817
from sphinx.util.nodes import split_explicit_title
1918
from sphinx.util.compat import Directive
2019
from sphinx.writers.html import HTMLTranslator
2120
from sphinx.writers.latex import LaTeXTranslator
22-
from sphinx.locale import versionlabels
2321

2422
# monkey-patch reST parser to disable alphabetic and roman enumerated lists
2523
from docutils.parsers.rst.states import Body
@@ -28,20 +26,6 @@
2826
Body.enum.converters['lowerroman'] = \
2927
Body.enum.converters['upperroman'] = lambda x: None
3028

31-
SPHINX11 = sphinx.__version__[:3] < '1.2'
32-
33-
if SPHINX11:
34-
# monkey-patch HTML translator to give versionmodified paragraphs a class
35-
def new_visit_versionmodified(self, node):
36-
self.body.append(self.starttag(node, 'p', CLASS=node['type']))
37-
text = versionlabels[node['type']] % node['version']
38-
if len(node):
39-
text += ':'
40-
else:
41-
text += '.'
42-
self.body.append('<span class="versionmodified">%s</span> ' % text)
43-
HTMLTranslator.visit_versionmodified = new_visit_versionmodified
44-
4529
# monkey-patch HTML and LaTeX translators to keep doctest blocks in the
4630
# doctest docs themselves
4731
orig_visit_literal_block = HTMLTranslator.visit_literal_block
@@ -174,10 +158,9 @@ def run(self):
174158
content.line = node[0].line
175159
content += node[0].children
176160
node[0].replace_self(nodes.paragraph('', '', content))
177-
if not SPHINX11:
178161
node[0].insert(0, nodes.inline('', '%s: ' % text,
179162
classes=['versionmodified']))
180-
elif not SPHINX11:
163+
else:
181164
para = nodes.paragraph('', '',
182165
nodes.inline('', '%s.' % text, classes=['versionmodified']))
183166
if len(node):
@@ -188,9 +171,6 @@ def run(self):
188171
env.note_versionchange('deprecated', version[0], node, self.lineno)
189172
return [node] + messages
190173

191-
# for Sphinx < 1.2
192-
versionlabels['deprecated-removed'] = DeprecatedRemoved._label
193-
194174

195175
# Support for including Misc/NEWS
196176

@@ -289,14 +269,14 @@ def write(self, *ignored):
289269
document.append(doctree.ids[labelid])
290270
destination = StringOutput(encoding='utf-8')
291271
writer.write(document, destination)
292-
self.topics[label] = writer.output.encode('utf-8')
272+
self.topics[label] = writer.output
293273

294274
def finish(self):
295-
f = open(path.join(self.outdir, 'topics.py'), 'w')
275+
f = open(path.join(self.outdir, 'topics.py'), 'wb')
296276
try:
297-
f.write('# -*- coding: utf-8 -*-\n')
298-
f.write('# Autogenerated by Sphinx on %s\n' % asctime())
299-
f.write('topics = ' + pformat(self.topics) + '\n')
277+
f.write('# -*- coding: utf-8 -*-\n'.encode('utf-8'))
278+
f.write(('# Autogenerated by Sphinx on %s\n' % asctime()).encode('utf-8'))
279+
f.write(('topics = ' + pformat(self.topics) + '\n').encode('utf-8'))
300280
finally:
301281
f.close()
302282

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy