diff options
| author | Thomas Weißschuh <linux@weissschuh.net> | 2026-01-18 00:26:22 +0100 |
|---|---|---|
| committer | Jonathan Corbet <corbet@lwn.net> | 2026-01-23 11:27:22 -0700 |
| commit | 2d652135a16b413e38e6d7fed5244690d853756b (patch) | |
| tree | 31b56c1f6ff76e264040eb1ad8ab3fb8fb7fd50e | |
| parent | 5094f7d5ff2318edfe6f2a9632b31f0ddefd6ee4 (diff) | |
tools/docs: sphinx-build-wrapper: make 'rustdoc' a local variable
All users of this variable are now in the same method.
Demote the instance variable to a local one.
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-2-998e14b9ed9e@weissschuh.net>
| -rwxr-xr-x | tools/docs/sphinx-build-wrapper | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/tools/docs/sphinx-build-wrapper b/tools/docs/sphinx-build-wrapper index 2f65ddc85955..76dfd5cbf178 100755 --- a/tools/docs/sphinx-build-wrapper +++ b/tools/docs/sphinx-build-wrapper @@ -123,12 +123,10 @@ class SphinxBuilder: """ Checks if Rust is enabled """ - self.rustdoc = False - config = os.path.join(self.srctree, ".config") if not os.path.isfile(config): - return + return False re_rust = re.compile(r"CONFIG_RUST=(m|y)") @@ -136,11 +134,13 @@ class SphinxBuilder: with open(config, "r", encoding="utf-8") as fp: for line in fp: if re_rust.match(line): - self.rustdoc = True - return + return True except OSError as e: print(f"Failed to open {config}", file=sys.stderr) + return False + + return False def get_sphinx_extra_opts(self, n_jobs): """ @@ -259,8 +259,6 @@ class SphinxBuilder: self.get_sphinx_extra_opts(n_jobs) - self.check_rust() - # # If venv command line argument is specified, run Sphinx from venv # @@ -680,7 +678,8 @@ class SphinxBuilder: args.extend(["-D", f"latex_elements.papersize={paper}paper"]) - if self.rustdoc: + rustdoc = self.check_rust() + if rustdoc: args.extend(["-t", "rustdoc"]) if not sphinxdirs: @@ -768,7 +767,7 @@ class SphinxBuilder: elif target == "infodocs": self.handle_info(output_dirs) - if self.rustdoc and target in ["htmldocs", "epubdocs"]: + if rustdoc and target in ["htmldocs", "epubdocs"]: print("Building rust docs") if "MAKE" in self.env: cmd = [self.env["MAKE"]] |
