From: Thomas Weißschuh Date: Sat, 17 Jan 2026 23:26:21 +0000 (+0100) Subject: tools/docs: sphinx-build-wrapper: generate rust docs only once X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5094f7d5ff2318edfe6f2a9632b31f0ddefd6ee4;p=thirdparty%2Flinux.git tools/docs: sphinx-build-wrapper: generate rust docs only once Currently the rust docs are generated for each entry in SPHINXDIRS. This is unnecessary as they will be the same for each one. Move the generation, so it is executed only once. Signed-off-by: Thomas Weißschuh Reviewed-by: Mauro Carvalho Chehab Tested-by: Mauro Carvalho Chehab Signed-off-by: Jonathan Corbet Message-ID: <20260118-docs-spurious-rust-v1-1-998e14b9ed9e@weissschuh.net> --- diff --git a/tools/docs/sphinx-build-wrapper b/tools/docs/sphinx-build-wrapper index 9f1ae1485f846..2f65ddc859559 100755 --- a/tools/docs/sphinx-build-wrapper +++ b/tools/docs/sphinx-build-wrapper @@ -352,23 +352,6 @@ class SphinxBuilder: except (OSError, IOError) as e: print(f"Warning: Failed to copy CSS: {e}", file=sys.stderr) - if self.rustdoc: - print("Building rust docs") - if "MAKE" in self.env: - cmd = [self.env["MAKE"]] - else: - cmd = ["make", "LLVM=1"] - - cmd += [ "rustdoc"] - if self.verbose: - print(" ".join(cmd)) - - try: - subprocess.run(cmd, check=True) - except subprocess.CalledProcessError as e: - print(f"Ignored errors when building rustdoc: {e}. Is RUST enabled?", - file=sys.stderr) - def build_pdf_file(self, latex_cmd, from_dir, path): """Builds a single pdf file using latex_cmd""" try: @@ -785,6 +768,23 @@ class SphinxBuilder: elif target == "infodocs": self.handle_info(output_dirs) + if self.rustdoc and target in ["htmldocs", "epubdocs"]: + print("Building rust docs") + if "MAKE" in self.env: + cmd = [self.env["MAKE"]] + else: + cmd = ["make", "LLVM=1"] + + cmd += [ "rustdoc"] + if self.verbose: + print(" ".join(cmd)) + + try: + subprocess.run(cmd, check=True) + except subprocess.CalledProcessError as e: + print(f"Ignored errors when building rustdoc: {e}. Is RUST enabled?", + file=sys.stderr) + def jobs_type(value): """ Handle valid values for -j. Accepts Sphinx "-jauto", plus a number