Index: build/android/gyp/util/build_utils.py |
diff --git a/build/android/gyp/util/build_utils.py b/build/android/gyp/util/build_utils.py |
index b12c56252dc8dca0a95d447e888598c56efbed93..140e214dcee0ab27d651ff88150225582b1ea1d1 100644 |
--- a/build/android/gyp/util/build_utils.py |
+++ b/build/android/gyp/util/build_utils.py |
@@ -235,19 +235,20 @@ |
outfile.write(path, archive_path) |
-def MatchesGlob(path, filters): |
- """Returns whether the given path matches any of the given glob patterns.""" |
- return filters and any(fnmatch.fnmatch(path, f) for f in filters) |
- |
- |
def MergeZips(output, inputs, exclude_patterns=None): |
added_names = set() |
+ def Allow(name): |
+ if exclude_patterns is not None: |
+ for p in exclude_patterns: |
+ if fnmatch.fnmatch(name, p): |
+ return False |
+ return True |
with zipfile.ZipFile(output, 'w') as out_zip: |
for in_file in inputs: |
with zipfile.ZipFile(in_file, 'r') as in_zip: |
for name in in_zip.namelist(): |
- if not (name in added_names or MatchesGlob(name, exclude_patterns)): |
+ if name not in added_names and Allow(name): |
out_zip.writestr(name, in_zip.read(name)) |
added_names.add(name) |