diff options
author | Benjamin Peterson <benjamin@python.org> | 2019-10-08 03:37:45 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-08 03:37:45 (GMT) |
commit | c9a195ec0b830d719ce5ebf8abe82c6e4a3247b8 (patch) | |
tree | 246ad8640d2593b8881e2e541881a8b67b31e3dc | |
parent | 1c7b14197b10924e2efc1e6c99c720958be1f681 (diff) | |
download | cpython-c9a195ec0b830d719ce5ebf8abe82c6e4a3247b8.zip cpython-c9a195ec0b830d719ce5ebf8abe82c6e4a3247b8.tar.gz cpython-c9a195ec0b830d719ce5ebf8abe82c6e4a3247b8.tar.bz2 |
[2.7] Stop using deprecated logging API in Sphinx suspicious checker (GH-16635)
(cherry picked from commit ee171a26c1169abfae534b08acc0d95c6e45a22a)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
-rw-r--r-- | .travis.yml | 5 | ||||
-rw-r--r-- | Doc/Makefile | 2 | ||||
-rw-r--r-- | Doc/tools/extensions/suspicious.py | 10 |
3 files changed, 10 insertions, 7 deletions
diff --git a/.travis.yml b/.travis.yml index 80e9be7..cb9c059 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,13 +36,14 @@ matrix: - xvfb - os: linux language: python - python: 2.7 + # Build the docs against a stable version of Python so code bugs don't hold up doc-related PRs. + python: 3.6 env: TESTING=docs before_script: - cd Doc # Sphinx is pinned so that new versions that introduce new warnings won't suddenly cause build failures. # (Updating the version is fine as long as no warnings are raised by doing so.) - - python -m pip install sphinx~=1.6.1 + - python3 -m pip install sphinx~=2.0.1 script: - make check suspicious html SPHINXOPTS="-q -W -j4" diff --git a/Doc/Makefile b/Doc/Makefile index ebabc02..7ca4c7a 100644 --- a/Doc/Makefile +++ b/Doc/Makefile @@ -148,7 +148,7 @@ dist: cp -pPR build/epub/Python.epub dist/python-$(DISTVERSION)-docs.epub check: - $(PYTHON) tools/rstlint.py -i tools + $(PYTHON)2 tools/rstlint.py -i tools serve: ../Tools/scripts/serve.py build/html diff --git a/Doc/tools/extensions/suspicious.py b/Doc/tools/extensions/suspicious.py index 0a70e57..8d80f67 100644 --- a/Doc/tools/extensions/suspicious.py +++ b/Doc/tools/extensions/suspicious.py @@ -48,6 +48,7 @@ import sys from docutils import nodes from sphinx.builders import Builder +import sphinx.util detect_all = re.compile(r''' ::(?=[^=])| # two :: (but NOT ::=) @@ -85,6 +86,7 @@ class CheckSuspiciousMarkupBuilder(Builder): Checks for possibly invalid markup that may leak into the output. """ name = 'suspicious' + logger = sphinx.util.logging.getLogger("CheckSuspiciousMarkupBuilder") def init(self): # create output file @@ -116,7 +118,7 @@ class CheckSuspiciousMarkupBuilder(Builder): self.warn('Found %s/%s unused rules:' % (len(unused_rules), len(self.rules))) for rule in unused_rules: - self.info(repr(rule)) + self.logger.info(repr(rule)) return def check_issue(self, line, lineno, issue): @@ -146,7 +148,7 @@ class CheckSuspiciousMarkupBuilder(Builder): return False def report_issue(self, text, lineno, issue): - if not self.any_issue: self.info() + if not self.any_issue: self.logger.info() self.any_issue = True self.write_log_entry(lineno, issue, text) if py3: @@ -181,7 +183,7 @@ class CheckSuspiciousMarkupBuilder(Builder): A csv file, with exactly the same format as suspicious.csv Fields: document name (normalized), line number, issue, surrounding text """ - self.info("loading ignore rules... ", nonl=1) + self.logger.info("loading ignore rules... ", nonl=1) self.rules = rules = [] try: if py3: @@ -206,7 +208,7 @@ class CheckSuspiciousMarkupBuilder(Builder): rule = Rule(docname, lineno, issue, text) rules.append(rule) f.close() - self.info('done, %d rules loaded' % len(self.rules)) + self.logger.info('done, %d rules loaded' % len(self.rules)) def get_lineno(node): |