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 ddb3cb52a356a940fd5ff63b61243f1068b023c4..0f6ae37ba665742b8804ae8bca14ab9d632ceb6a 100644 |
--- a/build/android/gyp/util/build_utils.py |
+++ b/build/android/gyp/util/build_utils.py |
@@ -232,6 +232,23 @@ def ZipDir(output, base_dir): |
outfile.write(path, archive_path) |
+def MergeZips(output, inputs, exclude_patterns=None): |
+ 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 Allow(name): |
+ with in_zip.open(name) as zip_entry: |
newt (away)
2014/09/08 20:27:30
can't you just do:
out_zip.writestr(name, in_
cjhopman
2014/09/08 23:02:18
Done.
|
+ out_zip.writestr(name, zip_entry.read()) |
+ |
+ |
def PrintWarning(message): |
print 'WARNING: ' + message |