diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2019-10-29 17:22:43 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2019-12-17 19:36:32 +0100 |
commit | e2c546358f0eaccc001f457a9eec0ecbe9d3bed7 (patch) | |
tree | cf4aad72249cbf5fb8958e648f8ac9899405a76b /docs/sphinx/kernellog.py | |
parent | a358bca24026a377e0804e137a4499e4e041918d (diff) | |
download | qemu-e2c546358f0eaccc001f457a9eec0ecbe9d3bed7.zip qemu-e2c546358f0eaccc001f457a9eec0ecbe9d3bed7.tar.gz qemu-e2c546358f0eaccc001f457a9eec0ecbe9d3bed7.tar.bz2 |
docs: import Linux kernel-doc script and extension
Import Linux's kernel-doc script as of commit 15e2544ed38a1e, as well
as the Sphinx extension to call kernel-doc according to the arguments
and parameters given to a reStructuredText directive.
The kernel-doc extension accepts a filename, which is relative to
the QEMU source tree root. The extension also notifies Sphinx about the
document dependency on the file, causing the document to be rebuilt when
the file has been changed.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'docs/sphinx/kernellog.py')
-rw-r--r-- | docs/sphinx/kernellog.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/docs/sphinx/kernellog.py b/docs/sphinx/kernellog.py new file mode 100644 index 0000000..af924f5 --- /dev/null +++ b/docs/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) + + |