Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c9a195e

Browse files
benjaminppablogsal
andauthoredOct 8, 2019
[2.7] Stop using deprecated logging API in Sphinx suspicious checker (pythonGH-16635)
(cherry picked from commit ee171a2) Co-authored-by: Pablo Galindo <[email protected]>
1 parent 1c7b141 commit c9a195e

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed
 

Diff for: ‎.travis.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,14 @@ matrix:
3636
- xvfb
3737
- os: linux
3838
language: python
39-
python: 2.7
39+
# Build the docs against a stable version of Python so code bugs don't hold up doc-related PRs.
40+
python: 3.6
4041
env: TESTING=docs
4142
before_script:
4243
- cd Doc
4344
# Sphinx is pinned so that new versions that introduce new warnings won't suddenly cause build failures.
4445
# (Updating the version is fine as long as no warnings are raised by doing so.)
45-
- python -m pip install sphinx~=1.6.1
46+
- python3 -m pip install sphinx~=2.0.1
4647
script:
4748
- make check suspicious html SPHINXOPTS="-q -W -j4"
4849

Diff for: ‎Doc/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ dist:
148148
cp -pPR build/epub/Python.epub dist/python-$(DISTVERSION)-docs.epub
149149

150150
check:
151-
$(PYTHON) tools/rstlint.py -i tools
151+
$(PYTHON)2 tools/rstlint.py -i tools
152152

153153
serve:
154154
../Tools/scripts/serve.py build/html

Diff for: ‎Doc/tools/extensions/suspicious.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848

4949
from docutils import nodes
5050
from sphinx.builders import Builder
51+
import sphinx.util
5152

5253
detect_all = re.compile(r'''
5354
::(?=[^=])| # two :: (but NOT ::=)
@@ -85,6 +86,7 @@ class CheckSuspiciousMarkupBuilder(Builder):
8586
Checks for possibly invalid markup that may leak into the output.
8687
"""
8788
name = 'suspicious'
89+
logger = sphinx.util.logging.getLogger("CheckSuspiciousMarkupBuilder")
8890

8991
def init(self):
9092
# create output file
@@ -116,7 +118,7 @@ def finish(self):
116118
self.warn('Found %s/%s unused rules:' %
117119
(len(unused_rules), len(self.rules)))
118120
for rule in unused_rules:
119-
self.info(repr(rule))
121+
self.logger.info(repr(rule))
120122
return
121123

122124
def check_issue(self, line, lineno, issue):
@@ -146,7 +148,7 @@ def is_ignored(self, line, lineno, issue):
146148
return False
147149

148150
def report_issue(self, text, lineno, issue):
149-
if not self.any_issue: self.info()
151+
if not self.any_issue: self.logger.info()
150152
self.any_issue = True
151153
self.write_log_entry(lineno, issue, text)
152154
if py3:
@@ -181,7 +183,7 @@ def load_rules(self, filename):
181183
A csv file, with exactly the same format as suspicious.csv
182184
Fields: document name (normalized), line number, issue, surrounding text
183185
"""
184-
self.info("loading ignore rules... ", nonl=1)
186+
self.logger.info("loading ignore rules... ", nonl=1)
185187
self.rules = rules = []
186188
try:
187189
if py3:
@@ -206,7 +208,7 @@ def load_rules(self, filename):
206208
rule = Rule(docname, lineno, issue, text)
207209
rules.append(rule)
208210
f.close()
209-
self.info('done, %d rules loaded' % len(self.rules))
211+
self.logger.info('done, %d rules loaded' % len(self.rules))
210212

211213

212214
def get_lineno(node):

0 commit comments

Comments
 (0)
Please sign in to comment.