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

Side by Side Diff: slave/skia_slave_scripts/utils/gs_utils.py

Issue 648353002: Remove Skia's forked buildbot code (Closed) Base URL: https://skia.googlesource.com/buildbot.git@master
Patch Set: Address comment Created 6 years, 2 months 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 unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """Wrapper around common repo's gs_utils.py with buildbot-specific overrides."""
7
8 # System-level imports
9 import os
10 import sys
11
12 # Make sure the "common" repo is in PYTHON_PATH
13 _BUILDBOT_PATH = os.path.realpath(os.path.join(
14 os.path.dirname(os.path.abspath(__file__)),
15 os.pardir, os.pardir, os.pardir))
16 _COMMON_REPO_PATH = os.path.join(_BUILDBOT_PATH, 'common')
17 if not _COMMON_REPO_PATH in sys.path:
18 sys.path.insert(0, _COMMON_REPO_PATH)
19
20 # Local imports
21 from py.utils import gs_utils as superclass_module
22
23 _DEFAULT_BOTO_FILE_PATH = os.path.join(
24 _BUILDBOT_PATH, 'third_party', 'chromium_buildbot', 'site_config', '.boto')
25 _GS_PREFIX = 'gs://'
26
27
28 class GSUtils(superclass_module.GSUtils):
29 """Wrapper around common repo's GSUtils with buildbot-specific overrides."""
30
31 # The ACLs to use while copying playback (SKP) files to Google Storage.
32 # They should not be world-readable!
33 #
34 # TODO(rmistry): Change "playback" variable names to something that makes more
35 # sense to Eric.
36 PLAYBACK_CANNED_ACL = superclass_module.GSUtils.PredefinedACL.PRIVATE
37 PLAYBACK_FINEGRAINED_ACL_LIST = [
38 (superclass_module.GSUtils.IdType.GROUP_BY_DOMAIN, 'google.com',
39 superclass_module.GSUtils.Permission.READ),
40 ]
41
42 def __init__(self, boto_file_path=_DEFAULT_BOTO_FILE_PATH):
43 """Override constructor to use buildbot credentials by default."""
44 super(GSUtils, self).__init__(boto_file_path=boto_file_path)
45
46 @staticmethod
47 def with_gs_prefix(bucket_name):
48 """Returns the bucket_name with _GS_PREFIX at the front.
49
50 If _GS_PREFIX is already there, returns bucket_name as is.
51
52 Examples:
53 bucket1 -> gs://bucket1
54 gs://bucket2 -> gs://bucket2
55 """
56 if bucket_name.startswith(_GS_PREFIX):
57 return bucket_name
58 else:
59 return _GS_PREFIX + str(bucket_name)
OLDNEW
« no previous file with comments | « slave/skia_slave_scripts/utils/gclient_utils.py ('k') | slave/skia_slave_scripts/utils/old_gs_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698