]> git.lizzy.rs Git - rust.git/commitdiff
bootstrap.py: Filter instead of iteration
authorTatsuyuki Ishi <ishitatsuyuki@gmail.com>
Fri, 19 May 2017 11:36:49 +0000 (20:36 +0900)
committerTatsuyuki Ishi <ishitatsuyuki@gmail.com>
Thu, 25 May 2017 04:57:51 +0000 (13:57 +0900)
src/bootstrap/bootstrap.py

index d5f2e3f99a9ac01e6f01d8af342494b1c678c9ef..b7a13b8096905c42d5238526c1a65c82b4b5b314 100644 (file)
@@ -565,15 +565,14 @@ class RustBuild(object):
         submodules = [s.split()[1] for s in subprocess.check_output(
             ["git", "config", "--file", os.path.join(
                 self.rust_root, ".gitmodules"), "--get-regexp", "path"]).splitlines()]
-        for module in submodules:
-            if module.endswith(b"llvm") and \
-                    (self.get_toml('llvm-config') or self.get_mk('CFG_LLVM_ROOT')):
-                continue
-            if module.endswith(b"jemalloc") and \
-                    (self.get_toml('jemalloc') or self.get_mk('CFG_JEMALLOC_ROOT')):
-                continue
-            run(["git", "submodule", "update",
-                      "--init", module], cwd=self.rust_root)
+        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'))))
+                      ]
+        run(["git", "submodule", "update",
+                  "--init"] + submodules, cwd=self.rust_root)
         run(["git", "submodule", "-q", "foreach", "git",
                   "reset", "-q", "--hard"], cwd=self.rust_root)
         run(["git", "submodule", "-q", "foreach", "git",