diff options
author | Adam Turner <9087854+AA-Turner@users.noreply.github.com> | 2022-06-21 15:04:46 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-21 15:04:46 (GMT) |
commit | 0efe3a1636c143fe0694a8e4d25d6eae19e0d618 (patch) | |
tree | 6f5b27302956979ea868743410c02bb87c2ed086 /Doc/tools | |
parent | 6f8875eba38b08c802905635759b5f905e3a415c (diff) | |
download | cpython-0efe3a1636c143fe0694a8e4d25d6eae19e0d618.zip cpython-0efe3a1636c143fe0694a8e4d25d6eae19e0d618.tar.gz cpython-0efe3a1636c143fe0694a8e4d25d6eae19e0d618.tar.bz2 |
gh-86986: Drop compatibility support for Sphinx 2 (GH-93737)
* Revert "bpo-42843: Keep Sphinx 1.8 and Sphinx 2 compatibility (GH-24282)"
This reverts commit 5c1f15b4b1024cbf0acc85832f0c623d1a4605fd
* Revert "bpo-42579: Make workaround for various versions of Sphinx more robust (GH-23662)"
This reverts commit b63a620014b67a6e63d10783149c41baaf59def8.
Diffstat (limited to 'Doc/tools')
-rw-r--r-- | Doc/tools/extensions/pyspecific.py | 7 | ||||
-rw-r--r-- | Doc/tools/extensions/suspicious.py | 41 |
2 files changed, 8 insertions, 40 deletions
diff --git a/Doc/tools/extensions/pyspecific.py b/Doc/tools/extensions/pyspecific.py index 2e122b5..68c1e1b 100644 --- a/Doc/tools/extensions/pyspecific.py +++ b/Doc/tools/extensions/pyspecific.py @@ -418,12 +418,7 @@ class DeprecatedRemoved(Directive): translatable=False) node.append(para) env = self.state.document.settings.env - # deprecated pre-Sphinx-2 method - if hasattr(env, 'note_versionchange'): - env.note_versionchange('deprecated', version[0], node, self.lineno) - # new method - else: - env.get_domain('changeset').note_changeset(node) + env.get_domain('changeset').note_changeset(node) return [node] + messages diff --git a/Doc/tools/extensions/suspicious.py b/Doc/tools/extensions/suspicious.py index c3de4d7..2d581a8 100644 --- a/Doc/tools/extensions/suspicious.py +++ b/Doc/tools/extensions/suspicious.py @@ -44,7 +44,6 @@ Copyright 2009 Gabriel A. Genellina import os import re import csv -import sys from docutils import nodes from sphinx.builders import Builder @@ -55,9 +54,7 @@ detect_all = re.compile(r''' :[a-zA-Z][a-zA-Z0-9]+| # :foo `| # ` (seldom used by itself) (?<!\.)\.\.[ \t]*\w+: # .. foo: (but NOT ... else:) - ''', re.UNICODE | re.VERBOSE).finditer - -py3 = sys.version_info >= (3, 0) + ''', re.VERBOSE).finditer class Rule: @@ -152,32 +149,15 @@ class CheckSuspiciousMarkupBuilder(Builder): def report_issue(self, text, lineno, issue): self.any_issue = True self.write_log_entry(lineno, issue, text) - if py3: - self.logger.warning('[%s:%d] "%s" found in "%-.120s"' % + self.logger.warning('[%s:%d] "%s" found in "%-.120s"' % (self.docname, lineno, issue, text)) - else: - self.logger.warning( - '[%s:%d] "%s" found in "%-.120s"' % ( - self.docname.encode(sys.getdefaultencoding(),'replace'), - lineno, - issue.encode(sys.getdefaultencoding(),'replace'), - text.strip().encode(sys.getdefaultencoding(),'replace'))) self.app.statuscode = 1 def write_log_entry(self, lineno, issue, text): - if py3: - f = open(self.log_file_name, 'a') - writer = csv.writer(f, dialect) - writer.writerow([self.docname, lineno, issue, text.strip()]) - f.close() - else: - f = open(self.log_file_name, 'ab') - writer = csv.writer(f, dialect) - writer.writerow([self.docname.encode('utf-8'), - lineno, - issue.encode('utf-8'), - text.strip().encode('utf-8')]) - f.close() + f = open(self.log_file_name, 'a') + writer = csv.writer(f, dialect) + writer.writerow([self.docname, lineno, issue, text.strip()]) + f.close() def load_rules(self, filename): """Load database of previously ignored issues. @@ -188,10 +168,7 @@ class CheckSuspiciousMarkupBuilder(Builder): self.logger.info("loading ignore rules... ", nonl=1) self.rules = rules = [] try: - if py3: - f = open(filename, 'r') - else: - f = open(filename, 'rb') + f = open(filename, 'r') except IOError: return for i, row in enumerate(csv.reader(f)): @@ -203,10 +180,6 @@ class CheckSuspiciousMarkupBuilder(Builder): lineno = int(lineno) else: lineno = None - if not py3: - docname = docname.decode('utf-8') - issue = issue.decode('utf-8') - text = text.decode('utf-8') rule = Rule(docname, lineno, issue, text) rules.append(rule) f.close() |