| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Archives or replays webpages and creates SKPs in a Google Storage location. | 6 """Archives or replays webpages and creates SKPs in a Google Storage location. |
| 7 | 7 |
| 8 To archive webpages and store SKP files (archives should be rarely updated): | 8 To archive webpages and store SKP files (archives should be rarely updated): |
| 9 | 9 |
| 10 cd skia | 10 cd skia |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 self._bucket = remove_prefix(self._data_store_url.lstrip(), | 488 self._bucket = remove_prefix(self._data_store_url.lstrip(), |
| 489 gs_utils.GS_PREFIX) | 489 gs_utils.GS_PREFIX) |
| 490 self.gs = gs_utils.GSUtils() | 490 self.gs = gs_utils.GSUtils() |
| 491 def target_name(self): | 491 def target_name(self): |
| 492 return self._data_store_url | 492 return self._data_store_url |
| 493 def target_type(self): | 493 def target_type(self): |
| 494 return 'Google Storage' | 494 return 'Google Storage' |
| 495 def does_storage_object_exist(self, *args): | 495 def does_storage_object_exist(self, *args): |
| 496 return self.gs.does_storage_object_exist(self._bucket, *args) | 496 return self.gs.does_storage_object_exist(self._bucket, *args) |
| 497 def delete_path(self, path): | 497 def delete_path(self, path): |
| 498 return self.gs.delete_file(self._bucket, path) | 498 _, files = self.gs.list_bucket_contents(self._bucket, subdir=path) |
| 499 for f in files: |
| 500 self.gs.delete_file(self._bucket, posixpath.join(path, f)) |
| 499 def download_file(self, *args): | 501 def download_file(self, *args): |
| 500 self.gs.download_file(self._bucket, *args) | 502 self.gs.download_file(self._bucket, *args) |
| 501 def upload_dir_contents(self, source_dir, **kwargs): | 503 def upload_dir_contents(self, source_dir, **kwargs): |
| 502 self.gs.upload_dir_contents(source_dir, self._bucket, **kwargs) | 504 self.gs.upload_dir_contents(source_dir, self._bucket, **kwargs) |
| 503 | 505 |
| 504 class LocalFileSystemDataStore(DataStore): | 506 class LocalFileSystemDataStore(DataStore): |
| 505 def __init__(self, data_store_location): | 507 def __init__(self, data_store_location): |
| 506 self._base_dir = data_store_location | 508 self._base_dir = data_store_location |
| 507 def target_name(self): | 509 def target_name(self): |
| 508 return self._base_dir | 510 return self._base_dir |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 '--skia_tools is specified then the debugger is not run.', | 592 '--skia_tools is specified then the debugger is not run.', |
| 591 default=False) | 593 default=False) |
| 592 option_parser.add_option( | 594 option_parser.add_option( |
| 593 '', '--skp_prefix', | 595 '', '--skp_prefix', |
| 594 help='Prefix to add to the names of generated SKPs.', | 596 help='Prefix to add to the names of generated SKPs.', |
| 595 default=None) | 597 default=None) |
| 596 options, unused_args = option_parser.parse_args() | 598 options, unused_args = option_parser.parse_args() |
| 597 | 599 |
| 598 playback = SkPicturePlayback(options) | 600 playback = SkPicturePlayback(options) |
| 599 sys.exit(playback.Run()) | 601 sys.exit(playback.Run()) |
| OLD | NEW |