Skip to content

Commit 46ebd83

Browse files
committed
bootstrap.py: decode to str
Also, improve the split mechanism to address space in paths.
1 parent 5bcf06a commit 46ebd83

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/bootstrap/bootstrap.py

+10-11
Original file line numberDiff line numberDiff line change
@@ -557,20 +557,19 @@ def update_submodules(self):
557557
self.get_toml('submodules') == "false" or \
558558
self.get_mk('CFG_DISABLE_MANAGE_SUBMODULES') == "1":
559559
return
560-
561560
print('Updating submodules')
561+
default_encoding = sys.getdefaultencoding()
562562
run(["git", "submodule", "-q", "sync"], cwd=self.rust_root)
563-
# FIXME: nobody does, but this won't work well with whitespace in
564-
# submodule path
565-
submodules = [s.split()[1] for s in subprocess.check_output(
566-
["git", "config", "--file", os.path.join(
567-
self.rust_root, ".gitmodules"), "--get-regexp", "path"]).splitlines()]
563+
submodules = [s.split(' ', 1)[1] for s in subprocess.check_output(
564+
["git", "config", "--file", os.path.join(self.rust_root, ".gitmodules"),
565+
"--get-regexp", "path"]
566+
).decode(default_encoding).splitlines()]
568567
submodules = [module for module in submodules
569-
if not ((module.endswith(b"llvm") and
570-
(self.get_toml('llvm-config') or self.get_mk('CFG_LLVM_ROOT'))) or
571-
(module.endswith(b"jemalloc") and
572-
(self.get_toml('jemalloc') or self.get_mk('CFG_JEMALLOC_ROOT'))))
573-
]
568+
if not ((module.endswith("llvm") and
569+
(self.get_toml('llvm-config') or self.get_mk('CFG_LLVM_ROOT'))) or
570+
(module.endswith("jemalloc") and
571+
(self.get_toml('jemalloc') or self.get_mk('CFG_JEMALLOC_ROOT'))))
572+
]
574573
run(["git", "submodule", "update",
575574
"--init"] + submodules, cwd=self.rust_root)
576575
run(["git", "submodule", "-q", "foreach", "git",

0 commit comments

Comments
 (0)