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

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

Issue 949803002: Deconstructed APK prototyping Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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/rewrite_deconstruct_manifest.py ('k') | no next file » | 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 if os.path.isabs(name): 193 if os.path.isabs(name):
194 raise Exception('Absolute zip path: %s' % name) 194 raise Exception('Absolute zip path: %s' % name)
195 195
196 196
197 def ExtractAll(zip_path, path=None, no_clobber=True, pattern=None): 197 def ExtractAll(zip_path, path=None, no_clobber=True, pattern=None):
198 if path is None: 198 if path is None:
199 path = os.getcwd() 199 path = os.getcwd()
200 elif not os.path.exists(path): 200 elif not os.path.exists(path):
201 MakeDirectory(path) 201 MakeDirectory(path)
202 202
203 files = None
203 with zipfile.ZipFile(zip_path) as z: 204 with zipfile.ZipFile(zip_path) as z:
204 for name in z.namelist(): 205 for name in z.namelist():
205 if name.endswith('/'): 206 if name.endswith('/'):
206 continue 207 continue
207 if pattern is not None: 208 if pattern is not None:
208 if not fnmatch.fnmatch(name, pattern): 209 if not fnmatch.fnmatch(name, pattern):
209 continue 210 continue
210 CheckZipPath(name) 211 CheckZipPath(name)
211 if no_clobber: 212 if no_clobber:
212 output_path = os.path.join(path, name) 213 output_path = os.path.join(path, name)
213 if os.path.exists(output_path): 214 if os.path.exists(output_path):
214 raise Exception( 215 raise Exception(
215 'Path already exists from zip: %s %s %s' 216 'Path already exists from zip: %s %s %s'
216 % (zip_path, name, output_path)) 217 % (zip_path, name, output_path))
217 218
218 z.extractall(path=path) 219 z.extractall(path=path)
220 files = list(set(z.namelist()))
221 return files
219 222
220 223
221 def DoZip(inputs, output, base_dir): 224 def DoZip(inputs, output, base_dir):
222 with zipfile.ZipFile(output, 'w') as outfile: 225 with zipfile.ZipFile(output, 'w') as outfile:
223 for f in inputs: 226 for f in inputs:
224 CheckZipPath(os.path.relpath(f, base_dir)) 227 CheckZipPath(os.path.relpath(f, base_dir))
225 outfile.write(f, os.path.relpath(f, base_dir)) 228 outfile.write(f, os.path.relpath(f, base_dir))
226 229
227 230
228 def ZipDir(output, base_dir): 231 def ZipDir(output, base_dir):
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 file_jsons[file_path] = ReadJson(file_path) 368 file_jsons[file_path] = ReadJson(file_path)
366 369
367 expansion = file_jsons[file_path] 370 expansion = file_jsons[file_path]
368 for k in lookup_path[1:]: 371 for k in lookup_path[1:]:
369 expansion = expansion[k] 372 expansion = expansion[k]
370 373
371 new_args[i] = arg[:match.start()] + str(expansion) 374 new_args[i] = arg[:match.start()] + str(expansion)
372 375
373 return new_args 376 return new_args
374 377
OLDNEW
« no previous file with comments | « build/android/gyp/rewrite_deconstruct_manifest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698