summaryrefslogtreecommitdiffstats
path: root/Documentation/sphinx/kernellog.py
diff options
context:
space:
mode:
authorJonathan Corbet2019-05-21 22:23:43 +0200
committerJonathan Corbet2019-05-23 17:22:00 +0200
commit096ea522e84ea68f8e6c41e5e7294731a81e29bc (patch)
tree09d55c2c5ce3c65cf73bb26ade3000969f702eeb /Documentation/sphinx/kernellog.py
parentDocumentation: kdump: fix minor typo (diff)
downloadkernel-qcow2-linux-096ea522e84ea68f8e6c41e5e7294731a81e29bc.tar.gz
kernel-qcow2-linux-096ea522e84ea68f8e6c41e5e7294731a81e29bc.tar.xz
kernel-qcow2-linux-096ea522e84ea68f8e6c41e5e7294731a81e29bc.zip
doc: Cope with Sphinx logging deprecations
Recent versions of sphinx will emit messages like: Documentation/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. Cc: stable@vger.kernel.org Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'Documentation/sphinx/kernellog.py')
-rw-r--r--Documentation/sphinx/kernellog.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/Documentation/sphinx/kernellog.py b/Documentation/sphinx/kernellog.py
new file mode 100644
index 000000000000..af924f51a7dc
--- /dev/null
+++ b/Documentation/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)
+
+