Skip to content

Commit 5094f7d

Browse files
t-8chJonathan Corbet
authored andcommitted
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>
1 parent 3671845 commit 5094f7d

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

tools/docs/sphinx-build-wrapper

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -352,23 +352,6 @@ class SphinxBuilder:
352352
except (OSError, IOError) as e:
353353
print(f"Warning: Failed to copy CSS: {e}", file=sys.stderr)
354354

355-
if self.rustdoc:
356-
print("Building rust docs")
357-
if "MAKE" in self.env:
358-
cmd = [self.env["MAKE"]]
359-
else:
360-
cmd = ["make", "LLVM=1"]
361-
362-
cmd += [ "rustdoc"]
363-
if self.verbose:
364-
print(" ".join(cmd))
365-
366-
try:
367-
subprocess.run(cmd, check=True)
368-
except subprocess.CalledProcessError as e:
369-
print(f"Ignored errors when building rustdoc: {e}. Is RUST enabled?",
370-
file=sys.stderr)
371-
372355
def build_pdf_file(self, latex_cmd, from_dir, path):
373356
"""Builds a single pdf file using latex_cmd"""
374357
try:
@@ -785,6 +768,23 @@ class SphinxBuilder:
785768
elif target == "infodocs":
786769
self.handle_info(output_dirs)
787770

771+
if self.rustdoc and target in ["htmldocs", "epubdocs"]:
772+
print("Building rust docs")
773+
if "MAKE" in self.env:
774+
cmd = [self.env["MAKE"]]
775+
else:
776+
cmd = ["make", "LLVM=1"]
777+
778+
cmd += [ "rustdoc"]
779+
if self.verbose:
780+
print(" ".join(cmd))
781+
782+
try:
783+
subprocess.run(cmd, check=True)
784+
except subprocess.CalledProcessError as e:
785+
print(f"Ignored errors when building rustdoc: {e}. Is RUST enabled?",
786+
file=sys.stderr)
787+
788788
def jobs_type(value):
789789
"""
790790
Handle valid values for -j. Accepts Sphinx "-jauto", plus a number

0 commit comments

Comments
 (0)