fix pydoc-topics to work with Sphinx 1.7 (GH-6475)

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

Co-authored-by: Benjamin Peterson <benjamin@python.org>
This commit is contained in:
Miss Islington (bot) 2018-04-16 23:32:43 -07:00 committed by GitHub
parent 3b4e756b43
commit 7899153c1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -23,9 +23,10 @@ from docutils import nodes, utils
from sphinx import addnodes
from sphinx.builders import Builder
from sphinx.locale import translators
from sphinx.util import status_iterator
from sphinx.util.nodes import split_explicit_title
from sphinx.writers.html import HTMLTranslator
from sphinx.writers.text import TextWriter
from sphinx.writers.text import TextWriter, TextTranslator
from sphinx.writers.latex import LaTeXTranslator
from sphinx.domains.python import PyModulelevel, PyClassmember
@ -295,8 +296,11 @@ pydoc_topic_labels = [
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'
@ -306,9 +310,9 @@ class PydocTopicsBuilder(Builder):
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