From 7899153c1f9e6808c7729200f62ab2a70cfa9427 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Mon, 16 Apr 2018 23:32:43 -0700 Subject: [PATCH] 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 acfb087f9f5590e5174a30eced3c2fe911f49d70) Co-authored-by: Benjamin Peterson --- Doc/tools/extensions/pyspecific.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Doc/tools/extensions/pyspecific.py b/Doc/tools/extensions/pyspecific.py index bb69366ecd4..92506e7b327 100644 --- a/Doc/tools/extensions/pyspecific.py +++ b/Doc/tools/extensions/pyspecific.py @@ -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