Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Unified Diff: tools/skp/webpages_playback.py

Issue 780493002: Remove Google Storage scheme prefix correctly from gs base name in webpages_playback (Closed) Base URL: https://skia.googlesource.com/skia.git@webpages-replay-run-render-pdf
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/skp/webpages_playback.py
diff --git a/tools/skp/webpages_playback.py b/tools/skp/webpages_playback.py
index 99808eda32419d4b0783f150e2f90c62935cfe48..d2df01f32daf29591bacece873e87e5fce5711a8 100644
--- a/tools/skp/webpages_playback.py
+++ b/tools/skp/webpages_playback.py
@@ -109,6 +109,10 @@ GS_FINE_GRAINED_ACL_LIST = [
gs_utils.GSUtils.Permission.READ),
]
+def remove_prefix(s, prefix):
+ if s.startswith(prefix):
+ return s[len(prefix):]
+ return s
class SkPicturePlayback(object):
"""Class that archives or replays webpages and creates SKPs."""
@@ -177,7 +181,7 @@ class SkPicturePlayback(object):
raw_input("Please press a key when you are ready to proceed...")
elif not os.path.isfile(CREDENTIALS_FILE_PATH):
# Download the credentials.json file from Google Storage.
- gs_bucket = self._dest_gsbase.lstrip(gs_utils.GS_PREFIX)
+ gs_bucket = remove_prefix(self._dest_gsbase.lstrip(), gs_utils.GS_PREFIX)
gs_utils.GSUtils().download_file(gs_bucket, CREDENTIALS_GS_PATH,
CREDENTIALS_FILE_PATH)
@@ -319,7 +323,7 @@ class SkPicturePlayback(object):
if self._alternate_upload_dir:
dest_dir_name = self._alternate_upload_dir
- gs_bucket = self._dest_gsbase.lstrip(gs_utils.GS_PREFIX)
+ gs_bucket = remove_prefix(self._dest_gsbase.lstrip(), gs_utils.GS_PREFIX)
gs_utils.GSUtils().upload_dir_contents(
LOCAL_PLAYBACK_ROOT_DIR, gs_bucket, dest_dir_name,
upload_if=gs_utils.GSUtils.UploadIf.IF_MODIFIED,
@@ -382,7 +386,7 @@ class SkPicturePlayback(object):
'webpages_archive',
page_set_json_name)
gs = gs_utils.GSUtils()
- gs_bucket = self._dest_gsbase.lstrip(gs_utils.GS_PREFIX)
+ gs_bucket = remove_prefix(self._dest_gsbase.lstrip(), gs_utils.GS_PREFIX)
if (gs.does_storage_object_exist(gs_bucket, wpr_source) and
gs.does_storage_object_exist(gs_bucket, page_set_source)):
gs.download_file(gs_bucket, wpr_source,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698