From 8883c5cd1cef3e58959e86227b93eb0aa84561fc Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Tue, 16 Oct 2018 14:19:13 -0500 Subject: [PATCH] Update sphinx extension logging Sphinx 1.6 deprecated using the application object to perform logging and it will be removed in the upcoming 2.0 release. This updates our extensions to use the recommended sphinx.util.logging instead. Change-Id: I5015714caaed5b031a2ebdbaec4cb934cd29b455 Signed-off-by: Sean McGinnis --- doc/source/_exts/members.py | 7 +++++-- doc/source/_exts/teamtable.py | 13 +++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/doc/source/_exts/members.py b/doc/source/_exts/members.py index 053718b..2d8f8ca 100644 --- a/doc/source/_exts/members.py +++ b/doc/source/_exts/members.py @@ -18,6 +18,9 @@ import re from docutils import nodes from docutils.parsers.rst.directives.tables import Table from docutils.parsers.rst import directives +from sphinx.util import logging + +LOG = logging.getLogger(__name__) # Full name (IRC nickname) [expires in] {role} _PATTERN = re.compile('(?P.*)\s+\((?P.*)\)\s+\[(?P.*)\](\s+\{(?P.*)\})?') @@ -33,7 +36,7 @@ def _parse_members_file(app, filename): continue m = _PATTERN.match(line) if not m: - app.warning('Could not parse line %d of %s: %r' % + LOG.warning('Could not parse line %d of %s: %r' % (linum, filename, line)) continue yield m.groupdict() @@ -150,5 +153,5 @@ class MembersTable(Table): return table def setup(app): - app.info('loading members extension') + LOG.info('loading members extension') app.add_directive('memberstable', MembersTable) diff --git a/doc/source/_exts/teamtable.py b/doc/source/_exts/teamtable.py index 9d3615f..9572a89 100644 --- a/doc/source/_exts/teamtable.py +++ b/doc/source/_exts/teamtable.py @@ -12,14 +12,16 @@ # License for the specific language governing permissions and limitations # under the License. -"""Build a table of the current teams -""" +"""Build a table of the current teams""" + +import yaml from docutils import nodes from docutils.parsers.rst.directives.tables import Table from docutils.parsers.rst import directives +from sphinx.util import logging -import yaml +LOG = logging.getLogger(__name__) class TeamTable(Table): @@ -34,7 +36,6 @@ class TeamTable(Table): } def run(self): env = self.state.document.settings.env - app = env.app if self.options.get('headers') is not None: self.HEADERS = self.options.get('headers').split(",") @@ -68,8 +69,8 @@ class TeamTable(Table): # Now find the real path to the file, relative to where we are. rel_filename, filename = env.relfn2path(datafile) - app.info('loading teamtable') - app.info('reading %s' % filename) + LOG.info('loading teamtable') + LOG.info('reading %s' % filename) with open(filename, 'r') as f: _teams_yaml = yaml.load(f.read())