diff options
author | Jonathan Corbet <corbet@lwn.net> | 2025-02-10 11:28:12 -0700 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2025-02-10 11:28:12 -0700 |
commit | 1ce8294cfefb968aabefbf888d0a66af624622e8 (patch) | |
tree | d51a339feb084061c14fc29a035b27fb83bfcfec /Documentation/sphinx/kerneldoc.py | |
parent | 2b087edf588c66d149a7ba29bd37f2ad6edbdc9f (diff) | |
parent | 1c7e66bc5d20ac7779130e146d70066b3af4711c (diff) |
Merge branch 'mauro' into docs-mw
Mauro says:
This series replace get_abi.pl with a Python version.
I originally started it due to some issues I noticed when searching for
ABI symbols. While I could just go ahead and fix the already existing
script, I noticed that the script maintainance didn't have much care over
all those years, probably because it is easier to find Python programmers
those days.
Also, the code is complex and was not using modules or classes and
were using lots of global variables.
So, I decided to rewrite it in Python. I started with a manual conversion
for each function. Yet, to avoid future maintainership issues, I opted to
divide the main code on three classes, each on a sepaparate file.
Just like the original RFC, I opted to keep the Sphinx kernel-abi module
on three different phases:
- call get_abi.py as an exec file;
- import AbiParser on a minimal integration scenario;
- cleanup the code to avoid needing to parse line numbers from the text.
This way, if something goes wrong, it would be easier to just revert any
offending patches, It also provides a better rationale about what each
logical change is doing.
The initial patches on this series do some preparation work and
cleans some ABI symbol bugs that lack ":" delimiter.
Diffstat (limited to 'Documentation/sphinx/kerneldoc.py')
-rw-r--r-- | Documentation/sphinx/kerneldoc.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Documentation/sphinx/kerneldoc.py b/Documentation/sphinx/kerneldoc.py index ec1ddfff1863..be5b8fbf373f 100644 --- a/Documentation/sphinx/kerneldoc.py +++ b/Documentation/sphinx/kerneldoc.py @@ -39,7 +39,7 @@ from docutils.statemachine import ViewList from docutils.parsers.rst import directives, Directive import sphinx from sphinx.util.docutils import switch_source_input -import kernellog +from sphinx.util import logging __version__ = '1.0' @@ -56,6 +56,7 @@ class KernelDocDirective(Directive): 'functions': directives.unchanged, } has_content = False + logger = logging.getLogger('kerneldoc') def run(self): env = self.state.document.settings.env @@ -109,8 +110,7 @@ class KernelDocDirective(Directive): cmd += [filename] try: - kernellog.verbose(env.app, - 'calling kernel-doc \'%s\'' % (" ".join(cmd))) + self.logger.verbose("calling kernel-doc '%s'" % (" ".join(cmd))) p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() @@ -120,8 +120,8 @@ class KernelDocDirective(Directive): if p.returncode != 0: sys.stderr.write(err) - kernellog.warn(env.app, - 'kernel-doc \'%s\' failed with return code %d' % (" ".join(cmd), p.returncode)) + self.logger.warning("kernel-doc '%s' failed with return code %d" + % (" ".join(cmd), p.returncode)) return [nodes.error(None, nodes.paragraph(text = "kernel-doc missing"))] elif env.config.kerneldoc_verbosity > 0: sys.stderr.write(err) @@ -148,8 +148,8 @@ class KernelDocDirective(Directive): return node.children except Exception as e: # pylint: disable=W0703 - kernellog.warn(env.app, 'kernel-doc \'%s\' processing failed with: %s' % - (" ".join(cmd), str(e))) + self.logger.warning("kernel-doc '%s' processing failed with: %s" % + (" ".join(cmd), str(e))) return [nodes.error(None, nodes.paragraph(text = "kernel-doc missing"))] def do_parse(self, result, node): |