aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/sphinx
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>2025-11-18 20:09:26 +0100
committerJonathan Corbet <corbet@lwn.net>2025-11-21 10:32:30 -0700
commitcaa642bf3b767c4b33a62c6e2c2708fafb88ea6c (patch)
tree2832d47cfc331b00f3341ee4effb3faffd807611 /Documentation/sphinx
parent55fb2d572623c6ce81b3519c51309c9127dbd1c8 (diff)
downloadlinux-caa642bf3b767c4b33a62c6e2c2708fafb88ea6c.tar.gz
tools/docs/get_feat.py: convert get_feat.pl to Python
As we want to call Python code directly at the Sphinx extension, convert get_feat.pl to Python. The code was made to be (almost) bug-compatible with the Perl version, with two exceptions: 1. Currently, Perl script outputs a wrong table if arch is set to a non-existing value; 2. the ReST table output when --feat is used without --arch has an invalid format, as the number of characters for the table delimiters are wrong. Those two bugs were fixed while testing the conversion. Additionally, another caveat was solved: the output when --feat is used without arch and the feature doesn't exist doesn't contain an empty table anymore. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <03c26cee1ec567804735a33047e625ef5ab7bfa8.1763492868.git.mchehab+huawei@kernel.org>
Diffstat (limited to 'Documentation/sphinx')
-rw-r--r--Documentation/sphinx/kernel_feat.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Documentation/sphinx/kernel_feat.py b/Documentation/sphinx/kernel_feat.py
index 81c67ef23d8dea..1dcbfe335a658f 100644
--- a/Documentation/sphinx/kernel_feat.py
+++ b/Documentation/sphinx/kernel_feat.py
@@ -42,6 +42,11 @@ from docutils.statemachine import ViewList
from docutils.parsers.rst import directives, Directive
from sphinx.util.docutils import switch_source_input
+srctree = os.path.abspath(os.environ["srctree"])
+sys.path.insert(0, os.path.join(srctree, "tools/docs/lib"))
+
+from parse_features import ParseFeature # pylint: disable=C0413
+
def ErrorString(exc): # Shamelessly stolen from docutils
return f'{exc.__class__.__name}: {exc}'