Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Thomas Weißschuh and committed by
Jonathan Corbet
ffb569d5 6f9a96cc

+5 -2
+5 -2
tools/docs/sphinx-build-wrapper
··· 119 119 120 120 return path 121 121 122 - def check_rust(self): 122 + def check_rust(self, sphinxdirs): 123 123 """ 124 124 Checks if Rust is enabled 125 125 """ 126 126 config = os.path.join(self.srctree, ".config") 127 + 128 + if not {'.', 'rust'}.intersection(sphinxdirs): 129 + return False 127 130 128 131 if not os.path.isfile(config): 129 132 return False ··· 694 691 695 692 args.extend(["-D", f"latex_elements.papersize={paper}paper"]) 696 693 697 - rustdoc = self.check_rust() 694 + rustdoc = self.check_rust(sphinxdirs_list) 698 695 if rustdoc: 699 696 args.extend(["-t", "rustdoc"]) 700 697