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 platform | 10 import platform |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 location = os.path.join(directory, 'gsutil') | 256 location = os.path.join(directory, 'gsutil') |
257 if os.path.isfile(location): | 257 if os.path.isfile(location): |
258 GSUtil.GSUTIL_IS_SHELL_SCRIPT = False | 258 GSUtil.GSUTIL_IS_SHELL_SCRIPT = False |
259 GSUtil.GSUTIL_PATH = location | 259 GSUtil.GSUTIL_PATH = location |
260 break | 260 break |
261 assert GSUtil.GSUTIL_PATH | 261 assert GSUtil.GSUTIL_PATH |
262 | 262 |
263 def execute(self, gsutil_args): | 263 def execute(self, gsutil_args): |
264 self._layzCalculateGSUtilPath() | 264 self._layzCalculateGSUtilPath() |
265 | 265 |
266 env = dict(os.environ) | |
267 # If we're on the buildbot, we use a specific boto file. | |
268 user_name = os.environ.get( | |
269 'USERNAME' if sys.platform == 'win32' else 'USER', '') | |
270 if user_name == 'chrome-bot': | |
271 boto_config = { | |
272 'Linux': '/mnt/data/b/build/site_config/.boto', | |
273 'Darwin': '/Volumes/data/b/build/site_config/.boto', | |
274 'Windows': r'e:\b\build\site_config\.boto', | |
275 }[platform.system()] | |
276 env['AWS_CREDENTIAL_FILE'] = boto_config | |
277 env['BOTO_CONFIG'] = boto_config | |
278 | |
279 if GSUtil.GSUTIL_IS_SHELL_SCRIPT: | 266 if GSUtil.GSUTIL_IS_SHELL_SCRIPT: |
280 gsutil_command = [GSUtil.GSUTIL_PATH] | 267 gsutil_command = [GSUtil.GSUTIL_PATH] |
281 else: | 268 else: |
282 gsutil_command = [sys.executable, GSUtil.GSUTIL_PATH] | 269 gsutil_command = [sys.executable, GSUtil.GSUTIL_PATH] |
283 | 270 |
284 return run(gsutil_command + gsutil_args, env=env, | 271 return run(gsutil_command + gsutil_args, |
285 shell=(GSUtil.GSUTIL_IS_SHELL_SCRIPT and | 272 shell=(GSUtil.GSUTIL_IS_SHELL_SCRIPT and |
286 sys.platform == 'win32')) | 273 sys.platform == 'win32')) |
287 | 274 |
288 def upload(self, local_path, remote_path, recursive=False, | 275 def upload(self, local_path, remote_path, recursive=False, |
289 public=False, multithread=False): | 276 public=False, multithread=False): |
290 assert remote_path.startswith('gs://') | 277 assert remote_path.startswith('gs://') |
291 | 278 |
292 if multithread: | 279 if multithread: |
293 args = ['-m', 'cp'] | 280 args = ['-m', 'cp'] |
294 else: | 281 else: |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 363 |
377 return checksum_filename | 364 return checksum_filename |
378 | 365 |
379 def GetChannelFromName(name): | 366 def GetChannelFromName(name): |
380 """Get the channel from the name. Bleeding edge builders don't | 367 """Get the channel from the name. Bleeding edge builders don't |
381 have a suffix.""" | 368 have a suffix.""" |
382 channel_name = string.split(name, '-').pop() | 369 channel_name = string.split(name, '-').pop() |
383 if channel_name in Channel.ALL_CHANNELS: | 370 if channel_name in Channel.ALL_CHANNELS: |
384 return channel_name | 371 return channel_name |
385 return Channel.BLEEDING_EDGE | 372 return Channel.BLEEDING_EDGE |
OLD | NEW |