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

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Thomas Weißschuh and committed by
Jonathan Corbet
2d652135 5094f7d5

+8 -9
+8 -9
tools/docs/sphinx-build-wrapper
··· 123 123 """ 124 124 Checks if Rust is enabled 125 125 """ 126 - self.rustdoc = False 127 - 128 126 config = os.path.join(self.srctree, ".config") 129 127 130 128 if not os.path.isfile(config): 131 - return 129 + return False 132 130 133 131 re_rust = re.compile(r"CONFIG_RUST=(m|y)") 134 132 ··· 134 136 with open(config, "r", encoding="utf-8") as fp: 135 137 for line in fp: 136 138 if re_rust.match(line): 137 - self.rustdoc = True 138 - return 139 + return True 139 140 140 141 except OSError as e: 141 142 print(f"Failed to open {config}", file=sys.stderr) 143 + return False 144 + 145 + return False 142 146 143 147 def get_sphinx_extra_opts(self, n_jobs): 144 148 """ ··· 258 258 self.env = os.environ.copy() 259 259 260 260 self.get_sphinx_extra_opts(n_jobs) 261 - 262 - self.check_rust() 263 261 264 262 # 265 263 # If venv command line argument is specified, run Sphinx from venv ··· 678 680 679 681 args.extend(["-D", f"latex_elements.papersize={paper}paper"]) 680 682 681 - if self.rustdoc: 683 + rustdoc = self.check_rust() 684 + if rustdoc: 682 685 args.extend(["-t", "rustdoc"]) 683 686 684 687 if not sphinxdirs: ··· 767 768 elif target == "infodocs": 768 769 self.handle_info(output_dirs) 769 770 770 - if self.rustdoc and target in ["htmldocs", "epubdocs"]: 771 + if rustdoc and target in ["htmldocs", "epubdocs"]: 771 772 print("Building rust docs") 772 773 if "MAKE" in self.env: 773 774 cmd = [self.env["MAKE"]]