From 5bcf06aa188a29266c58d7b875683faf070f3191 Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Fri, 19 May 2017 20:36:49 +0900 Subject: [PATCH] bootstrap.py: Filter instead of iteration --- src/bootstrap/bootstrap.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index d5f2e3f99a9..b7a13b80969 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -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", -- 2.44.0