[Python-checkins] [2.7] fix pydoc-topics to work with Sphinx 1.7 (GH-6502)

Benjamin Peterson webhook-mailer at python.org
Tue Apr 17 02:54:11 EDT 2018


https://github.com/python/cpython/commit/7d196762134f890eeb1d5a53acbf9dc9bf7e4d48
commit: 7d196762134f890eeb1d5a53acbf9dc9bf7e4d48
branch: 2.7
author: Benjamin Peterson <benjamin at python.org>
committer: GitHub <noreply at github.com>
date: 2018-04-16T23:54:08-07:00
summary:

[2.7] fix pydoc-topics to work with Sphinx 1.7 (GH-6502)

In fact, we now require a newer Sphinx version because APIs have moved around..
(cherry picked from commit acfb087f9f5590e5174a30eced3c2fe911f49d70)

files:
M Doc/tools/extensions/pyspecific.py

diff --git a/Doc/tools/extensions/pyspecific.py b/Doc/tools/extensions/pyspecific.py
index 7bbd580d203b..8c45274bb27b 100644
--- a/Doc/tools/extensions/pyspecific.py
+++ b/Doc/tools/extensions/pyspecific.py
@@ -15,9 +15,11 @@
 from docutils import nodes, utils
 from docutils.parsers.rst import Directive
 
+from sphinx.util import status_iterator
 from sphinx.util.nodes import split_explicit_title
 from sphinx.writers.html import HTMLTranslator
 from sphinx.writers.latex import LaTeXTranslator
+from sphinx.writers.text import TextTranslator
 
 # monkey-patch reST parser to disable alphabetic and roman enumerated lists
 from docutils.parsers.rst.states import Body
@@ -158,8 +160,11 @@ def run(self):
 class PydocTopicsBuilder(Builder):
     name = 'pydoc-topics'
 
+    default_translator_class = TextTranslator
+
     def init(self):
         self.topics = {}
+        self.secnumbers = {}
 
     def get_outdated_docs(self):
         return 'all pydoc topics'
@@ -169,9 +174,9 @@ def get_target_uri(self, docname, typ=None):
 
     def write(self, *ignored):
         writer = TextWriter(self)
-        for label in self.status_iterator(pydoc_topic_labels,
-                                          'building topics... ',
-                                          length=len(pydoc_topic_labels)):
+        for label in status_iterator(pydoc_topic_labels,
+                                     'building topics... ',
+                                     length=len(pydoc_topic_labels)):
             if label not in self.env.domaindata['std']['labels']:
                 self.warn('label %r not in documentation' % label)
                 continue



More information about the Python-checkins mailing list