Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Unified Diff: build/android/gyp/util/build_utils.py

Issue 1324203002: Reland of Fix javac command never caching input .md5s (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@md5-extra
Patch Set: fixed empty jars Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/gyp/javac.py ('k') | build/android/rezip.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 140e214dcee0ab27d651ff88150225582b1ea1d1..b12c56252dc8dca0a95d447e888598c56efbed93 100644
--- a/build/android/gyp/util/build_utils.py
+++ b/build/android/gyp/util/build_utils.py
@@ -235,20 +235,19 @@ def ZipDir(output, base_dir):
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 name not in added_names and Allow(name):
+ if not (name in added_names or MatchesGlob(name, exclude_patterns)):
out_zip.writestr(name, in_zip.read(name))
added_names.add(name)
« no previous file with comments | « build/android/gyp/javac.py ('k') | build/android/rezip.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698