Skip to content

Commit 6f9a96c

Browse files
t-8chJonathan Corbet
authored andcommitted
tools/docs: sphinx-build-wrapper: compute sphinxdirs_list earlier
An upcoming patch will require sphinxdirs_list to be available before the call to check_rust(). Move it up in the function. 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-3-998e14b9ed9e@weissschuh.net>
1 parent 2d65213 commit 6f9a96c

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

tools/docs/sphinx-build-wrapper

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,19 @@ class SphinxBuilder:
670670
if kerneldoc.startswith(self.srctree):
671671
kerneldoc = os.path.relpath(kerneldoc, self.srctree)
672672

673+
if not sphinxdirs:
674+
sphinxdirs = os.environ.get("SPHINXDIRS", ".")
675+
676+
#
677+
# sphinxdirs can be a list or a whitespace-separated string
678+
#
679+
sphinxdirs_list = []
680+
for sphinxdir in sphinxdirs:
681+
if isinstance(sphinxdir, list):
682+
sphinxdirs_list += sphinxdir
683+
else:
684+
sphinxdirs_list += sphinxdir.split()
685+
673686
args = [ "-b", builder, "-c", docs_dir ]
674687

675688
if builder == "latex":
@@ -682,9 +695,6 @@ class SphinxBuilder:
682695
if rustdoc:
683696
args.extend(["-t", "rustdoc"])
684697

685-
if not sphinxdirs:
686-
sphinxdirs = os.environ.get("SPHINXDIRS", ".")
687-
688698
#
689699
# The sphinx-build tool has a bug: internally, it tries to set
690700
# locale with locale.setlocale(locale.LC_ALL, ''). This causes a
@@ -695,16 +705,6 @@ class SphinxBuilder:
695705
except locale.Error:
696706
self.env["LC_ALL"] = "C"
697707

698-
#
699-
# sphinxdirs can be a list or a whitespace-separated string
700-
#
701-
sphinxdirs_list = []
702-
for sphinxdir in sphinxdirs:
703-
if isinstance(sphinxdir, list):
704-
sphinxdirs_list += sphinxdir
705-
else:
706-
sphinxdirs_list += sphinxdir.split()
707-
708708
#
709709
# Step 1: Build each directory in separate.
710710
#

0 commit comments

Comments
 (0)