Skip to content

Commit b713807

Browse files
mchehabJonathan Corbet
authored andcommitted
Documentation/sphinx/kernel_feat.py: use class directly
Now that get_feat is in Python, we don't need to use subprocess to fork an executable file: we can use the feature classes directly. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <c59d2542d7cc914fd5f8c84df966e63adc924cdc.1763492868.git.mchehab+huawei@kernel.org>
1 parent caa642b commit b713807

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

Documentation/sphinx/kernel_feat.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import codecs
3535
import os
3636
import re
37-
import subprocess
3837
import sys
3938

4039
from docutils import nodes, statemachine
@@ -43,9 +42,9 @@
4342
from sphinx.util.docutils import switch_source_input
4443

4544
srctree = os.path.abspath(os.environ["srctree"])
46-
sys.path.insert(0, os.path.join(srctree, "tools/docs/lib"))
45+
sys.path.insert(0, os.path.join(srctree, "tools/lib/python"))
4746

48-
from parse_features import ParseFeature # pylint: disable=C0413
47+
from feat.parse_features import ParseFeature # pylint: disable=C0413
4948

5049
def ErrorString(exc): # Shamelessly stolen from docutils
5150
return f'{exc.__class__.__name}: {exc}'
@@ -89,18 +88,16 @@ def run(self):
8988

9089
srctree = os.path.abspath(os.environ["srctree"])
9190

92-
args = [
93-
os.path.join(srctree, 'tools/docs/get_feat.pl'),
94-
'rest',
95-
'--enable-fname',
96-
'--dir',
97-
os.path.join(srctree, 'Documentation', self.arguments[0]),
98-
]
91+
feature_dir = os.path.join(srctree, 'Documentation', self.arguments[0])
9992

100-
if len(self.arguments) > 1:
101-
args.extend(['--arch', self.arguments[1]])
93+
feat = ParseFeature(feature_dir, False, True)
94+
feat.parse()
10295

103-
lines = subprocess.check_output(args, cwd=os.path.dirname(doc.current_source)).decode('utf-8')
96+
if len(self.arguments) > 1:
97+
arch = self.arguments[1]
98+
lines = feat.output_arch_table(arch)
99+
else:
100+
lines = feat.output_matrix()
104101

105102
line_regex = re.compile(r"^\.\. FILE (\S+)$")
106103

0 commit comments

Comments
 (0)