Skip to content

Commit 7d19676

Browse files
authored
[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 acfb087)
1 parent bad9a58 commit 7d19676

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Doc/tools/extensions/pyspecific.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@
1515
from docutils import nodes, utils
1616
from docutils.parsers.rst import Directive
1717

18+
from sphinx.util import status_iterator
1819
from sphinx.util.nodes import split_explicit_title
1920
from sphinx.writers.html import HTMLTranslator
2021
from sphinx.writers.latex import LaTeXTranslator
22+
from sphinx.writers.text import TextTranslator
2123

2224
# monkey-patch reST parser to disable alphabetic and roman enumerated lists
2325
from docutils.parsers.rst.states import Body
@@ -158,8 +160,11 @@ def run(self):
158160
class PydocTopicsBuilder(Builder):
159161
name = 'pydoc-topics'
160162

163+
default_translator_class = TextTranslator
164+
161165
def init(self):
162166
self.topics = {}
167+
self.secnumbers = {}
163168

164169
def get_outdated_docs(self):
165170
return 'all pydoc topics'
@@ -169,9 +174,9 @@ def get_target_uri(self, docname, typ=None):
169174

170175
def write(self, *ignored):
171176
writer = TextWriter(self)
172-
for label in self.status_iterator(pydoc_topic_labels,
173-
'building topics... ',
174-
length=len(pydoc_topic_labels)):
177+
for label in status_iterator(pydoc_topic_labels,
178+
'building topics... ',
179+
length=len(pydoc_topic_labels)):
175180
if label not in self.env.domaindata['std']['labels']:
176181
self.warn('label %r not in documentation' % label)
177182
continue

0 commit comments

Comments
 (0)