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

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

Issue 507523002: Add content_shell_apk target (and a bunch of its dependencies) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix PageTransitionTypes.template path 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
« no previous file with comments | « build/android/gyp/process_resources.py ('k') | build/android/gyp/write_build_config.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 return device_state.strip() == 'device' 184 return device_state.strip() == 'device'
185 185
186 186
187 def CheckZipPath(name): 187 def CheckZipPath(name):
188 if os.path.normpath(name) != name: 188 if os.path.normpath(name) != name:
189 raise Exception('Non-canonical zip path: %s' % name) 189 raise Exception('Non-canonical zip path: %s' % name)
190 if os.path.isabs(name): 190 if os.path.isabs(name):
191 raise Exception('Absolute zip path: %s' % name) 191 raise Exception('Absolute zip path: %s' % name)
192 192
193 193
194 def ExtractAll(zip_path, path=None, no_clobber=True): 194 def ExtractAll(zip_path, path=None, no_clobber=True, pattern=None):
195 if path is None: 195 if path is None:
196 path = os.getcwd() 196 path = os.getcwd()
197 elif not os.path.exists(path): 197 elif not os.path.exists(path):
198 MakeDirectory(path) 198 MakeDirectory(path)
199 199
200 with zipfile.ZipFile(zip_path) as z: 200 with zipfile.ZipFile(zip_path) as z:
201 for name in z.namelist(): 201 for name in z.namelist():
202 if name.endswith('/'): 202 if name.endswith('/'):
203 continue 203 continue
204 if pattern is not None:
205 if not fnmatch.fnmatch(name, pattern):
206 continue
204 CheckZipPath(name) 207 CheckZipPath(name)
205 if no_clobber: 208 if no_clobber:
206 output_path = os.path.join(path, name) 209 output_path = os.path.join(path, name)
207 if os.path.exists(output_path): 210 if os.path.exists(output_path):
208 raise Exception( 211 raise Exception(
209 'Path already exists from zip: %s %s %s' 212 'Path already exists from zip: %s %s %s'
210 % (zip_path, name, output_path)) 213 % (zip_path, name, output_path))
211 214
212 z.extractall(path=path) 215 z.extractall(path=path)
213 216
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 file_jsons[file_path] = ReadJson(file_path) 346 file_jsons[file_path] = ReadJson(file_path)
344 347
345 expansion = file_jsons[file_path] 348 expansion = file_jsons[file_path]
346 for k in lookup_path[1:]: 349 for k in lookup_path[1:]:
347 expansion = expansion[k] 350 expansion = expansion[k]
348 351
349 new_args[i] = arg[:match.start()] + str(expansion) 352 new_args[i] = arg[:match.start()] + str(expansion)
350 353
351 return new_args 354 return new_args
352 355
OLDNEW
« no previous file with comments | « build/android/gyp/process_resources.py ('k') | build/android/gyp/write_build_config.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698