Skip to content

Commit ffb569d

Browse files
t-8chJonathan Corbet
authored andcommitted
tools/docs: sphinx-build-wrapper: only generate rust docs when requested
When the user explicitly specifies SPHINXDIRS to build a specific subdirectory it is unexpected that the rust docs are also generated. Especially as their generation may dominate the execution time. Only generate the rust docs when they are part of the SPHINXDIRS requested by the user. 'rust/rustdocs' is not considered, as it is not a valid SPHINXDIRS anyways. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Tested-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <20260118-docs-spurious-rust-v1-4-998e14b9ed9e@weissschuh.net>
1 parent 6f9a96c commit ffb569d

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

tools/docs/sphinx-build-wrapper

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,15 @@ class SphinxBuilder:
119119

120120
return path
121121

122-
def check_rust(self):
122+
def check_rust(self, sphinxdirs):
123123
"""
124124
Checks if Rust is enabled
125125
"""
126126
config = os.path.join(self.srctree, ".config")
127127

128+
if not {'.', 'rust'}.intersection(sphinxdirs):
129+
return False
130+
128131
if not os.path.isfile(config):
129132
return False
130133

@@ -691,7 +694,7 @@ class SphinxBuilder:
691694

692695
args.extend(["-D", f"latex_elements.papersize={paper}paper"])
693696

694-
rustdoc = self.check_rust()
697+
rustdoc = self.check_rust(sphinxdirs_list)
695698
if rustdoc:
696699
args.extend(["-t", "rustdoc"])
697700

0 commit comments

Comments
 (0)