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

Side by Side Diff: chrome/test/ispy/client/boto_bucket.py

Issue 1418513007: Move find_depot_tools.py to build/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review fixes Created 5 years, 1 month 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
« no previous file with comments | « chrome/browser/web_dev_style/resource_checker_test.py ('k') | mojo/services/upload_service.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Implementation of CloudBucket using Google Cloud Storage as the backend.""" 5 """Implementation of CloudBucket using Google Cloud Storage as the backend."""
6 import os 6 import os
7 import sys 7 import sys
8 8
9 # boto requires depot_tools/third_party be in the path. Use 9 # boto requires depot_tools/third_party be in the path. Use
10 # src/tools/find_depot_tools.py to add this directory. 10 # src/build/find_depot_tools.py to add this directory.
11 sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, 11 sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir,
12 os.pardir, os.pardir, 'tools')) 12 os.pardir, os.pardir, 'build'))
13 import find_depot_tools 13 import find_depot_tools
14 DEPOT_TOOLS_PATH = find_depot_tools.add_depot_tools_to_path() 14 DEPOT_TOOLS_PATH = find_depot_tools.add_depot_tools_to_path()
15 sys.path.append(os.path.join(os.path.abspath(DEPOT_TOOLS_PATH), 'third_party')) 15 sys.path.append(os.path.join(os.path.abspath(DEPOT_TOOLS_PATH), 'third_party'))
16 import boto 16 import boto
17 17
18 from ispy.common import cloud_bucket 18 from ispy.common import cloud_bucket
19 19
20 20
21 class BotoCloudBucket(cloud_bucket.BaseCloudBucket): 21 class BotoCloudBucket(cloud_bucket.BaseCloudBucket):
22 """Interfaces with GS using the boto library.""" 22 """Interfaces with GS using the boto library."""
(...skipping 15 matching lines...) Expand all
38 key.key = path 38 key.key = path
39 return key 39 return key
40 40
41 # override 41 # override
42 def UploadFile(self, path, contents, content_type): 42 def UploadFile(self, path, contents, content_type):
43 key = self._GetKey(path) 43 key = self._GetKey(path)
44 key.set_metadata('Content-Type', content_type) 44 key.set_metadata('Content-Type', content_type)
45 key.set_contents_from_string(contents) 45 key.set_contents_from_string(contents)
46 # Open permissions for the appengine account to read/write. 46 # Open permissions for the appengine account to read/write.
47 key.add_email_grant('FULL_CONTROL', 47 key.add_email_grant('FULL_CONTROL',
48 'ispy.google.com@appspot.gserviceaccount.com') 48 'ispy.google.com@appspot.gserviceaccount.com')
49 49
50 # override 50 # override
51 def DownloadFile(self, path): 51 def DownloadFile(self, path):
52 key = self._GetKey(path) 52 key = self._GetKey(path)
53 if key.exists(): 53 if key.exists():
54 return key.get_contents_as_string() 54 return key.get_contents_as_string()
55 else: 55 else:
56 raise cloud_bucket.FileNotFoundError 56 raise cloud_bucket.FileNotFoundError
57 57
58 # override 58 # override
(...skipping 20 matching lines...) Expand all
79 if key.exists(): 79 if key.exists():
80 # Corrects a bug in boto that incorrectly generates a url 80 # Corrects a bug in boto that incorrectly generates a url
81 # to a resource in Google Cloud Storage. 81 # to a resource in Google Cloud Storage.
82 return key.generate_url(3600).replace('AWSAccessKeyId', 'GoogleAccessId') 82 return key.generate_url(3600).replace('AWSAccessKeyId', 'GoogleAccessId')
83 else: 83 else:
84 raise cloud_bucket.FileNotFoundError(path) 84 raise cloud_bucket.FileNotFoundError(path)
85 85
86 # override 86 # override
87 def GetAllPaths(self, prefix): 87 def GetAllPaths(self, prefix):
88 return (key.key for key in self.bucket.get_all_keys(prefix=prefix)) 88 return (key.key for key in self.bucket.get_all_keys(prefix=prefix))
OLDNEW
« no previous file with comments | « chrome/browser/web_dev_style/resource_checker_test.py ('k') | mojo/services/upload_service.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698