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

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

Issue 1308083002: Fix javac command never caching input .md5s (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@md5-extra
Patch Set: fnmatch helper Created 5 years, 4 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') | no next file » | 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 65b1a643c26a2ca920ff176af40bfcad85057f3d..55bfb1bc77aed567f3c2dc907b4a7db5e7dc7917 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)
jbudorick 2015/09/01 16:28:09 I don't think this is the same as Allow, which wou
agrieve 2015/09/01 16:58:18 It is intentionally different, in that it simplifi
+
+
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') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698