Skip to content

Commit 85999f0

Browse files
mchehabJonathan Corbet
authored andcommitted
docs: kernel_feat.py: add build dependencies
Ensure that the feature files will be regenerated if any changes happen at the Documentation/features files that were processed by gen_feat.pl. Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org> Link: https://lore.kernel.org/r/5cdf7a8300019129dcc09d4c2557f75908754445.1648290305.git.mchehab@kernel.org Signed-off-by: Jonathan Corbet <corbet@lwn.net>
1 parent 01096e5 commit 85999f0

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

Documentation/sphinx/kernel_feat.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
import codecs
3535
import os
36+
import re
3637
import subprocess
3738
import sys
3839

@@ -82,7 +83,7 @@ def run(self):
8283

8384
env = doc.settings.env
8485
cwd = path.dirname(doc.current_source)
85-
cmd = "get_feat.pl rest --dir "
86+
cmd = "get_feat.pl rest --enable-fname --dir "
8687
cmd += self.arguments[0]
8788

8889
if len(self.arguments) > 1:
@@ -102,7 +103,22 @@ def run(self):
102103
shell_env["srctree"] = srctree
103104

104105
lines = self.runCmd(cmd, shell=True, cwd=cwd, env=shell_env)
105-
nodeList = self.nestedParse(lines, fname)
106+
107+
line_regex = re.compile("^\.\. FILE (\S+)$")
108+
109+
out_lines = ""
110+
111+
for line in lines.split("\n"):
112+
match = line_regex.search(line)
113+
if match:
114+
fname = match.group(1)
115+
116+
# Add the file to Sphinx build dependencies
117+
env.note_dependency(os.path.abspath(fname))
118+
else:
119+
out_lines += line + "\n"
120+
121+
nodeList = self.nestedParse(out_lines, fname)
106122
return nodeList
107123

108124
def runCmd(self, cmd, **kwargs):

0 commit comments

Comments
 (0)