From 61779ce0a1f0ad020e28d2154d8fe3ddbec05ce6 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Sun, 14 Jul 2019 10:35:45 +0200 Subject: doc: Cope with Sphinx logging deprecations Recent versions of sphinx will emit messages like: doc/sphinx/kerneldoc.py:103: RemovedInSphinx20Warning: app.warning() is now deprecated. Use sphinx.util.logging instead. Switch to sphinx.util.logging to make this unsightly message go away. Alas, that interface was only added in version 1.6, so we have to add a version check to keep things working with older sphinxes. Signed-off-by: Jonathan Corbet Rebased for U-Boot Signed-off-by: Heinrich Schuchardt --- doc/sphinx/kernellog.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 doc/sphinx/kernellog.py (limited to 'doc/sphinx/kernellog.py') diff --git a/doc/sphinx/kernellog.py b/doc/sphinx/kernellog.py new file mode 100644 index 00000000000..af924f51a7d --- /dev/null +++ b/doc/sphinx/kernellog.py @@ -0,0 +1,28 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Sphinx has deprecated its older logging interface, but the replacement +# only goes back to 1.6. So here's a wrapper layer to keep around for +# as long as we support 1.4. +# +import sphinx + +if sphinx.__version__[:3] >= '1.6': + UseLogging = True + from sphinx.util import logging + logger = logging.getLogger('kerneldoc') +else: + UseLogging = False + +def warn(app, message): + if UseLogging: + logger.warning(message) + else: + app.warn(message) + +def verbose(app, message): + if UseLogging: + logger.verbose(message) + else: + app.verbose(message) + + -- cgit v1.2.3