| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
| 5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
| 6 | 6 |
| 7 # Gets or updates a DumpRenderTree (a nearly headless build of chrome). This is | 7 # Gets or updates a DumpRenderTree (a nearly headless build of chrome). This is |
| 8 # used for running browser tests of client applications. | 8 # used for running browser tests of client applications. |
| 9 | 9 |
| 10 import optparse | 10 import optparse |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 temp_zip = os.path.join(temp_dir, 'drt.zip') | 155 temp_zip = os.path.join(temp_dir, 'drt.zip') |
| 156 temp_zip_url = 'file://' + temp_zip | 156 temp_zip_url = 'file://' + temp_zip |
| 157 # It's nice to show download progress | 157 # It's nice to show download progress |
| 158 gsutil_visible('cp', latest, temp_zip_url) | 158 gsutil_visible('cp', latest, temp_zip_url) |
| 159 | 159 |
| 160 if platform.system() != 'Windows': | 160 if platform.system() != 'Windows': |
| 161 # The Python zip utility does not preserve executable permissions, but | 161 # The Python zip utility does not preserve executable permissions, but |
| 162 # this does not seem to be a problem for Windows, which does not have a | 162 # this does not seem to be a problem for Windows, which does not have a |
| 163 # built in zip utility. :-/ | 163 # built in zip utility. :-/ |
| 164 result, out = execute_command('unzip', temp_zip, '-d', temp_dir) | 164 result, out = execute_command('unzip', temp_zip, '-d', temp_dir) |
| 165 if result != 0: |
| 166 raise Exception('Execution of "unzip %s -d %s" failed: %s' % |
| 167 (temp_zip, temp_dir, str(out))) |
| 165 unzipped_dir = temp_dir + '/' + os.path.basename(latest)[:-4] #Remove .zip | 168 unzipped_dir = temp_dir + '/' + os.path.basename(latest)[:-4] #Remove .zip |
| 166 else: | 169 else: |
| 167 z = zipfile.ZipFile(temp_zip) | 170 z = zipfile.ZipFile(temp_zip) |
| 168 z.extractall(temp_dir) | 171 z.extractall(temp_dir) |
| 169 # -4 = remove .zip for dir name | 172 # -4 = remove .zip for dir name |
| 170 unzipped_dir = os.path.join(temp_dir, os.path.basename(latest)[:-4]) | 173 unzipped_dir = os.path.join(temp_dir, os.path.basename(latest)[:-4]) |
| 171 z.close() | 174 z.close() |
| 172 shutil.move(unzipped_dir, directory) | 175 shutil.move(unzipped_dir, directory) |
| 173 finally: | 176 finally: |
| 174 shutil.rmtree(temp_dir) | 177 shutil.rmtree(temp_dir) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 191 | 194 |
| 192 if args.dartium: | 195 if args.dartium: |
| 193 get_latest('Dartium', DARTIUM_DIR, DARTIUM_VERSION, | 196 get_latest('Dartium', DARTIUM_DIR, DARTIUM_VERSION, |
| 194 DARTIUM_LATEST_PATTERN, DARTIUM_PERMANENT_PREFIX) | 197 DARTIUM_LATEST_PATTERN, DARTIUM_PERMANENT_PREFIX) |
| 195 else: | 198 else: |
| 196 get_latest('DumpRenderTree', DRT_DIR, DRT_VERSION, | 199 get_latest('DumpRenderTree', DRT_DIR, DRT_VERSION, |
| 197 DRT_LATEST_PATTERN, DRT_PERMANENT_PREFIX) | 200 DRT_LATEST_PATTERN, DRT_PERMANENT_PREFIX) |
| 198 | 201 |
| 199 if __name__ == '__main__': | 202 if __name__ == '__main__': |
| 200 sys.exit(main()) | 203 sys.exit(main()) |
| OLD | NEW |