OLD | NEW |
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 contextlib | 5 import contextlib |
6 import fnmatch | 6 import fnmatch |
7 import json | 7 import json |
8 import os | 8 import os |
9 import pipes | 9 import pipes |
10 import shlex | 10 import shlex |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 raise Exception( | 190 raise Exception( |
191 'Path already exists from zip: %s %s %s' | 191 'Path already exists from zip: %s %s %s' |
192 % (zip_path, name, output_path)) | 192 % (zip_path, name, output_path)) |
193 | 193 |
194 z.extractall(path=path) | 194 z.extractall(path=path) |
195 | 195 |
196 | 196 |
197 def DoZip(inputs, output, base_dir): | 197 def DoZip(inputs, output, base_dir): |
198 with zipfile.ZipFile(output, 'w') as outfile: | 198 with zipfile.ZipFile(output, 'w') as outfile: |
199 for f in inputs: | 199 for f in inputs: |
200 CheckZipPath(f) | 200 CheckZipPath(os.path.relpath(f, base_dir)) |
201 outfile.write(f, os.path.relpath(f, base_dir)) | 201 outfile.write(f, os.path.relpath(f, base_dir)) |
202 | 202 |
203 | 203 |
204 def PrintWarning(message): | 204 def PrintWarning(message): |
205 print 'WARNING: ' + message | 205 print 'WARNING: ' + message |
206 | 206 |
207 | 207 |
208 def PrintBigWarning(message): | 208 def PrintBigWarning(message): |
209 print '***** ' * 8 | 209 print '***** ' * 8 |
210 PrintWarning(message) | 210 PrintWarning(message) |
211 print '***** ' * 8 | 211 print '***** ' * 8 |
OLD | NEW |