| 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 content shell (a nearly headless build of chrome). This is | 7 # Gets or updates a content shell (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 json | 10 import json |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 (temp_zip, temp_dir, str(out))) | 281 (temp_zip, temp_dir, str(out))) |
| 282 unzipped_dir = temp_dir + '/' + os.path.basename(latest)[:-len('.zip')] | 282 unzipped_dir = temp_dir + '/' + os.path.basename(latest)[:-len('.zip')] |
| 283 else: | 283 else: |
| 284 z = zipfile.ZipFile(temp_zip) | 284 z = zipfile.ZipFile(temp_zip) |
| 285 z.extractall(temp_dir) | 285 z.extractall(temp_dir) |
| 286 unzipped_dir = os.path.join(temp_dir, | 286 unzipped_dir = os.path.join(temp_dir, |
| 287 os.path.basename(latest)[:-len('.zip')]) | 287 os.path.basename(latest)[:-len('.zip')]) |
| 288 z.close() | 288 z.close() |
| 289 if directory == SDK_DIR: | 289 if directory == SDK_DIR: |
| 290 unzipped_dir = os.path.join(temp_dir, 'dart-sdk') | 290 unzipped_dir = os.path.join(temp_dir, 'dart-sdk') |
| 291 if os.path.exists(directory): |
| 292 raise Exception( |
| 293 'Removal of directory %s failed. Is the executable running?' % |
| 294 directory) |
| 291 shutil.move(unzipped_dir, directory) | 295 shutil.move(unzipped_dir, directory) |
| 292 finally: | 296 finally: |
| 293 shutil.rmtree(temp_dir) | 297 shutil.rmtree(temp_dir) |
| 294 | 298 |
| 295 # create the version stamp | 299 # create the version stamp |
| 296 v = open(version_file, 'w') | 300 v = open(version_file, 'w') |
| 297 v.write(latest) | 301 v.write(latest) |
| 298 v.close() | 302 v.close() |
| 299 | 303 |
| 300 print 'Successfully downloaded to %s' % directory | 304 print 'Successfully downloaded to %s' % directory |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 GetDartiumRevision('content_shell', bot, DRT_DIR, DRT_VERSION, | 351 GetDartiumRevision('content_shell', bot, DRT_DIR, DRT_VERSION, |
| 348 DRT_LATEST_PATTERN, DRT_PERMANENT_PATTERN, | 352 DRT_LATEST_PATTERN, DRT_PERMANENT_PATTERN, |
| 349 args.revision) | 353 args.revision) |
| 350 CopyDrtFont(DRT_DIR) | 354 CopyDrtFont(DRT_DIR) |
| 351 else: | 355 else: |
| 352 print ('Please specify the target you wish to download from Google Storage ' | 356 print ('Please specify the target you wish to download from Google Storage ' |
| 353 '("drt", "dartium", "chromedriver", or "sdk")') | 357 '("drt", "dartium", "chromedriver", or "sdk")') |
| 354 | 358 |
| 355 if __name__ == '__main__': | 359 if __name__ == '__main__': |
| 356 sys.exit(main()) | 360 sys.exit(main()) |
| OLD | NEW |