Skip to content

Commit d34aaa1

Browse files
committed
bootstrap.py: decode to str
Also, improve the split mechanism to address space in paths.
1 parent 8f111f3 commit d34aaa1

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
@@ -560,20 +560,19 @@ def update_submodules(self):
560560
self.get_toml('submodules') == "false" or \
561561
self.get_mk('CFG_DISABLE_MANAGE_SUBMODULES') == "1":
562562
return
563-
564563
print('Updating submodules')
564+
default_encoding = sys.getdefaultencoding()
565565
self.run(["git", "submodule", "-q", "sync"], cwd=self.rust_root)
566-
# FIXME: nobody does, but this won't work well with whitespace in
567-
# submodule path
568-
submodules = [s.split()[1] for s in subprocess.check_output(
569-
["git", "config", "--file", os.path.join(
570-
self.rust_root, ".gitmodules"), "--get-regexp", "path"]).splitlines()]
566+
submodules = [s.split(' ', 1)[1] for s in subprocess.check_output(
567+
["git", "config", "--file", os.path.join(self.rust_root, ".gitmodules"),
568+
"--get-regexp", "path"]
569+
).decode(default_encoding).splitlines()]
571570
submodules = [module for module in submodules
572-
if not ((module.endswith(b"llvm") and
573-
(self.get_toml('llvm-config') or self.get_mk('CFG_LLVM_ROOT'))) or
574-
(module.endswith(b"jemalloc") and
575-
(self.get_toml('jemalloc') or self.get_mk('CFG_JEMALLOC_ROOT'))))
576-
]
571+
if not ((module.endswith("llvm") and
572+
(self.get_toml('llvm-config') or self.get_mk('CFG_LLVM_ROOT'))) or
573+
(module.endswith("jemalloc") and
574+
(self.get_toml('jemalloc') or self.get_mk('CFG_JEMALLOC_ROOT'))))
575+
]
577576
self.run(["git", "submodule", "update",
578577
"--init"] + submodules, cwd=self.rust_root)
579578
self.run(["git", "submodule", "-q", "foreach", "git",

0 commit comments

Comments
 (0)