summaryrefslogtreecommitdiff
path: root/tools/docs
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2026-01-18 00:26:21 +0100
committerJonathan Corbet <corbet@lwn.net>2026-01-23 11:27:22 -0700
commit5094f7d5ff2318edfe6f2a9632b31f0ddefd6ee4 (patch)
tree209b8e8030934e93eb1bfcbe8d7196e9db31e0db /tools/docs
parent36718450835cf89572bf569bff0927bc7ef2568a (diff)
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 <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-1-998e14b9ed9e@weissschuh.net>
Diffstat (limited to 'tools/docs')
-rwxr-xr-xtools/docs/sphinx-build-wrapper34
1 files changed, 17 insertions, 17 deletions
diff --git a/tools/docs/sphinx-build-wrapper b/tools/docs/sphinx-build-wrapper
index 9f1ae1485f84..2f65ddc85955 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