| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
| 5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
| 6 | 6 |
| 7 import hashlib | 7 import hashlib |
| 8 import imp | 8 import imp |
| 9 import os | 9 import os |
| 10 import string | 10 import string |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 'win32': r'e:\b\build\site_config\.boto', | 257 'win32': r'e:\b\build\site_config\.boto', |
| 258 }[utils.GuessOS()] | 258 }[utils.GuessOS()] |
| 259 env['AWS_CREDENTIAL_FILE'] = boto_config | 259 env['AWS_CREDENTIAL_FILE'] = boto_config |
| 260 env['BOTO_CONFIG'] = boto_config | 260 env['BOTO_CONFIG'] = boto_config |
| 261 | 261 |
| 262 if GSUtil.GSUTIL_IS_SHELL_SCRIPT: | 262 if GSUtil.GSUTIL_IS_SHELL_SCRIPT: |
| 263 gsutil_command = [GSUtil.GSUTIL_PATH] | 263 gsutil_command = [GSUtil.GSUTIL_PATH] |
| 264 else: | 264 else: |
| 265 gsutil_command = [sys.executable, GSUtil.GSUTIL_PATH] | 265 gsutil_command = [sys.executable, GSUtil.GSUTIL_PATH] |
| 266 | 266 |
| 267 run(gsutil_command + gsutil_args, env=env, | 267 return run(gsutil_command + gsutil_args, env=env, |
| 268 shell=(GSUtil.GSUTIL_IS_SHELL_SCRIPT and sys.platform == 'win32')) | 268 shell=(GSUtil.GSUTIL_IS_SHELL_SCRIPT and |
| 269 sys.platform == 'win32')) |
| 269 | 270 |
| 270 def upload(self, local_path, remote_path, recursive=False, public=False): | 271 def upload(self, local_path, remote_path, recursive=False, public=False): |
| 271 assert remote_path.startswith('gs://') | 272 assert remote_path.startswith('gs://') |
| 272 | 273 |
| 273 args = ['cp'] | 274 args = ['cp'] |
| 274 if public: | 275 if public: |
| 275 args += ['-a', 'public-read'] | 276 args += ['-a', 'public-read'] |
| 276 if recursive: | 277 if recursive: |
| 277 args += ['-R'] | 278 args += ['-R'] |
| 278 args += [local_path, remote_path] | 279 args += [local_path, remote_path] |
| 279 self.execute(args) | 280 self.execute(args) |
| 280 | 281 |
| 282 def cat(self, remote_path): |
| 283 assert remote_path.startswith('gs://') |
| 284 |
| 285 args = ['cat', remote_path] |
| 286 (stdout, _, _) = self.execute(args) |
| 287 return stdout |
| 288 |
| 281 def setGroupReadACL(self, remote_path, group): | 289 def setGroupReadACL(self, remote_path, group): |
| 282 args = ['acl', 'ch', '-g', '%s:R' % group, remote_path] | 290 args = ['acl', 'ch', '-g', '%s:R' % group, remote_path] |
| 283 self.execute(args) | 291 self.execute(args) |
| 284 | 292 |
| 285 def setContentType(self, remote_path, content_type): | 293 def setContentType(self, remote_path, content_type): |
| 286 args = ['setmeta', '-h', 'Content-Type:%s' % content_type, remote_path] | 294 args = ['setmeta', '-h', 'Content-Type:%s' % content_type, remote_path] |
| 287 self.execute(args) | 295 self.execute(args) |
| 288 | 296 |
| 289 def remove(self, remote_path, recursive=False): | 297 def remove(self, remote_path, recursive=False): |
| 290 assert remote_path.startswith('gs://') | 298 assert remote_path.startswith('gs://') |
| (...skipping 30 matching lines...) Expand all Loading... |
| 321 | 329 |
| 322 return checksum_filename | 330 return checksum_filename |
| 323 | 331 |
| 324 def GetChannelFromName(name): | 332 def GetChannelFromName(name): |
| 325 """Get the channel from the name. Bleeding edge builders don't | 333 """Get the channel from the name. Bleeding edge builders don't |
| 326 have a suffix.""" | 334 have a suffix.""" |
| 327 channel_name = string.split(name, '-').pop() | 335 channel_name = string.split(name, '-').pop() |
| 328 if channel_name in Channel.ALL_CHANNELS: | 336 if channel_name in Channel.ALL_CHANNELS: |
| 329 return channel_name | 337 return channel_name |
| 330 return Channel.BLEEDING_EDGE | 338 return Channel.BLEEDING_EDGE |
| OLD | NEW |