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

Side by Side Diff: build/android/gyp/util/build_utils.py

Issue 525533003: Add content_shell_test_apk and a several dependencies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-content-shell-apk
Patch Set: Created 6 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 unified diff | Download patch
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import ast 5 import ast
6 import contextlib 6 import contextlib
7 import fnmatch 7 import fnmatch
8 import json 8 import json
9 import os 9 import os
10 import pipes 10 import pipes
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 def ZipDir(output, base_dir): 225 def ZipDir(output, base_dir):
226 with zipfile.ZipFile(output, 'w') as outfile: 226 with zipfile.ZipFile(output, 'w') as outfile:
227 for root, _, files in os.walk(base_dir): 227 for root, _, files in os.walk(base_dir):
228 for f in files: 228 for f in files:
229 path = os.path.join(root, f) 229 path = os.path.join(root, f)
230 archive_path = os.path.relpath(path, base_dir) 230 archive_path = os.path.relpath(path, base_dir)
231 CheckZipPath(archive_path) 231 CheckZipPath(archive_path)
232 outfile.write(path, archive_path) 232 outfile.write(path, archive_path)
233 233
234 234
235 def MergeZips(output, inputs, exclude_patterns=None):
236 def Allow(name):
237 if exclude_patterns is not None:
238 for p in exclude_patterns:
239 if fnmatch.fnmatch(name, p):
240 return False
241 return True
242
243 with zipfile.ZipFile(output, 'w') as out_zip:
244 for in_file in inputs:
245 with zipfile.ZipFile(in_file, 'r') as in_zip:
246 for name in in_zip.namelist():
247 if Allow(name):
248 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.
249 out_zip.writestr(name, zip_entry.read())
250
251
235 def PrintWarning(message): 252 def PrintWarning(message):
236 print 'WARNING: ' + message 253 print 'WARNING: ' + message
237 254
238 255
239 def PrintBigWarning(message): 256 def PrintBigWarning(message):
240 print '***** ' * 8 257 print '***** ' * 8
241 PrintWarning(message) 258 PrintWarning(message)
242 print '***** ' * 8 259 print '***** ' * 8
243 260
244 261
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 file_jsons[file_path] = ReadJson(file_path) 363 file_jsons[file_path] = ReadJson(file_path)
347 364
348 expansion = file_jsons[file_path] 365 expansion = file_jsons[file_path]
349 for k in lookup_path[1:]: 366 for k in lookup_path[1:]:
350 expansion = expansion[k] 367 expansion = expansion[k]
351 368
352 new_args[i] = arg[:match.start()] + str(expansion) 369 new_args[i] = arg[:match.start()] + str(expansion)
353 370
354 return new_args 371 return new_args
355 372
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698