about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTatsuyuki Ishi <ishitatsuyuki@gmail.com>2017-05-22 16:04:34 +0900
committerTatsuyuki Ishi <ishitatsuyuki@gmail.com>2017-05-25 13:58:10 +0900
commit46ebd832e3762cd6bf163ddb2af5c0ed6575eaa6 (patch)
tree148c11861307a2290114e3fa07fa81cbcde6711f
parent5bcf06aa188a29266c58d7b875683faf070f3191 (diff)
downloadrust-46ebd832e3762cd6bf163ddb2af5c0ed6575eaa6.tar.gz
rust-46ebd832e3762cd6bf163ddb2af5c0ed6575eaa6.zip
bootstrap.py: decode to str
Also, improve the split mechanism to address space in paths.
-rw-r--r--src/bootstrap/bootstrap.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index b7a13b80969..9a16a959fa4 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -557,20 +557,19 @@ class RustBuild(object):
                 self.get_toml('submodules') == "false" or \
                 self.get_mk('CFG_DISABLE_MANAGE_SUBMODULES') == "1":
             return
-
         print('Updating submodules')
+        default_encoding = sys.getdefaultencoding()
         run(["git", "submodule", "-q", "sync"], cwd=self.rust_root)
-        # FIXME: nobody does, but this won't work well with whitespace in
-        # submodule path
-        submodules = [s.split()[1] for s in subprocess.check_output(
-            ["git", "config", "--file", os.path.join(
-                self.rust_root, ".gitmodules"), "--get-regexp", "path"]).splitlines()]
+        submodules = [s.split(' ', 1)[1] for s in subprocess.check_output(
+            ["git", "config", "--file", os.path.join(self.rust_root, ".gitmodules"),
+             "--get-regexp", "path"]
+        ).decode(default_encoding).splitlines()]
         submodules = [module for module in submodules
-                      if not ((module.endswith(b"llvm") and
-                              (self.get_toml('llvm-config') or self.get_mk('CFG_LLVM_ROOT'))) or
-                      (module.endswith(b"jemalloc") and
-                       (self.get_toml('jemalloc') or self.get_mk('CFG_JEMALLOC_ROOT'))))
-                      ]
+                      if not ((module.endswith("llvm") and
+                               (self.get_toml('llvm-config') or self.get_mk('CFG_LLVM_ROOT'))) or
+                              (module.endswith("jemalloc") and
+                               (self.get_toml('jemalloc') or self.get_mk('CFG_JEMALLOC_ROOT'))))
+                     ]
         run(["git", "submodule", "update",
                   "--init"] + submodules, cwd=self.rust_root)
         run(["git", "submodule", "-q", "foreach", "git",