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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 self.gs.upload_dir_contents( | 369 self.gs.upload_dir_contents( |
370 LOCAL_PLAYBACK_ROOT_DIR, dest_dir=dest_dir_name, | 370 LOCAL_PLAYBACK_ROOT_DIR, dest_dir=dest_dir_name, |
371 upload_if=gs_utils.GSUtils.UploadIf.IF_MODIFIED, | 371 upload_if=gs_utils.GSUtils.UploadIf.IF_MODIFIED, |
372 predefined_acl=GS_PREDEFINED_ACL, | 372 predefined_acl=GS_PREDEFINED_ACL, |
373 fine_grained_acl_list=GS_FINE_GRAINED_ACL_LIST) | 373 fine_grained_acl_list=GS_FINE_GRAINED_ACL_LIST) |
374 | 374 |
375 print '\n\n=======New SKPs have been uploaded to %s =======\n\n' % ( | 375 print '\n\n=======New SKPs have been uploaded to %s =======\n\n' % ( |
376 posixpath.join(self.gs.target_name(), dest_dir_name, | 376 posixpath.join(self.gs.target_name(), dest_dir_name, |
377 SKPICTURES_DIR_NAME)) | 377 SKPICTURES_DIR_NAME)) |
378 | 378 |
379 if self._upload_to_partner_bucket: | |
380 print '\n\n=======Uploading to Partner bucket %s =======\n\n' % ( | |
381 PARTNERS_GS_BUCKET) | |
382 partner_gs = GoogleStorageDataStore(PARTNERS_GS_BUCKET) | |
383 partner_gs.delete_path(SKPICTURES_DIR_NAME) | |
384 partner_gs.upload_dir_contents( | |
385 os.path.join(LOCAL_PLAYBACK_ROOT_DIR, SKPICTURES_DIR_NAME), | |
386 dest_dir=SKPICTURES_DIR_NAME, | |
387 upload_if=gs_utils.GSUtils.UploadIf.IF_MODIFIED) | |
388 print '\n\n=======New SKPs have been uploaded to %s =======\n\n' % ( | |
389 posixpath.join(partner_gs.target_name(), SKPICTURES_DIR_NAME)) | |
390 else: | 379 else: |
391 print '\n\n=======Not Uploading to %s=======\n\n' % self.gs.target_type() | 380 print '\n\n=======Not Uploading to %s=======\n\n' % self.gs.target_type() |
392 print 'Generated resources are available in %s\n\n' % ( | 381 print 'Generated resources are available in %s\n\n' % ( |
393 LOCAL_PLAYBACK_ROOT_DIR) | 382 LOCAL_PLAYBACK_ROOT_DIR) |
394 | 383 |
| 384 if self._upload_to_partner_bucket: |
| 385 print '\n\n=======Uploading to Partner bucket %s =======\n\n' % ( |
| 386 PARTNERS_GS_BUCKET) |
| 387 partner_gs = GoogleStorageDataStore(PARTNERS_GS_BUCKET) |
| 388 partner_gs.delete_path(SKPICTURES_DIR_NAME) |
| 389 partner_gs.upload_dir_contents( |
| 390 os.path.join(LOCAL_PLAYBACK_ROOT_DIR, SKPICTURES_DIR_NAME), |
| 391 dest_dir=SKPICTURES_DIR_NAME, |
| 392 upload_if=gs_utils.GSUtils.UploadIf.IF_MODIFIED) |
| 393 print '\n\n=======New SKPs have been uploaded to %s =======\n\n' % ( |
| 394 posixpath.join(partner_gs.target_name(), SKPICTURES_DIR_NAME)) |
| 395 |
395 return 0 | 396 return 0 |
396 | 397 |
397 def _GetSkiaSkpFileName(self, page_set): | 398 def _GetSkiaSkpFileName(self, page_set): |
398 """Returns the SKP file name for Skia page sets.""" | 399 """Returns the SKP file name for Skia page sets.""" |
399 # /path/to/skia_yahooanswers_desktop.py -> skia_yahooanswers_desktop.py | 400 # /path/to/skia_yahooanswers_desktop.py -> skia_yahooanswers_desktop.py |
400 ps_filename = os.path.basename(page_set) | 401 ps_filename = os.path.basename(page_set) |
401 # skia_yahooanswers_desktop.py -> skia_yahooanswers_desktop | 402 # skia_yahooanswers_desktop.py -> skia_yahooanswers_desktop |
402 ps_basename, _ = os.path.splitext(ps_filename) | 403 ps_basename, _ = os.path.splitext(ps_filename) |
403 # skia_yahooanswers_desktop -> skia, yahooanswers, desktop | 404 # skia_yahooanswers_desktop -> skia, yahooanswers, desktop |
404 _, page_name, device = ps_basename.split('_') | 405 _, page_name, device = ps_basename.split('_') |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 '--skia_tools is specified then the debugger is not run.', | 598 '--skia_tools is specified then the debugger is not run.', |
598 default=False) | 599 default=False) |
599 option_parser.add_option( | 600 option_parser.add_option( |
600 '', '--skp_prefix', | 601 '', '--skp_prefix', |
601 help='Prefix to add to the names of generated SKPs.', | 602 help='Prefix to add to the names of generated SKPs.', |
602 default=None) | 603 default=None) |
603 options, unused_args = option_parser.parse_args() | 604 options, unused_args = option_parser.parse_args() |
604 | 605 |
605 playback = SkPicturePlayback(options) | 606 playback = SkPicturePlayback(options) |
606 sys.exit(playback.Run()) | 607 sys.exit(playback.Run()) |
OLD | NEW |