Chromium Code Reviews| 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 subprocess | 10 import subprocess |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 USE_DART_REPO_VERSION = False | 213 USE_DART_REPO_VERSION = False |
| 214 | 214 |
| 215 def _layzCalculateGSUtilPath(self): | 215 def _layzCalculateGSUtilPath(self): |
| 216 if not GSUtil.GSUTIL_PATH: | 216 if not GSUtil.GSUTIL_PATH: |
| 217 buildbot_gsutil = utils.GetBuildbotGSUtilPath() | 217 buildbot_gsutil = utils.GetBuildbotGSUtilPath() |
| 218 if os.path.isfile(buildbot_gsutil) and not GSUtil.USE_DART_REPO_VERSION: | 218 if os.path.isfile(buildbot_gsutil) and not GSUtil.USE_DART_REPO_VERSION: |
| 219 GSUtil.GSUTIL_IS_SHELL_SCRIPT = True | 219 GSUtil.GSUTIL_IS_SHELL_SCRIPT = True |
| 220 GSUtil.GSUTIL_PATH = buildbot_gsutil | 220 GSUtil.GSUTIL_PATH = buildbot_gsutil |
| 221 else: | 221 else: |
| 222 dart_gsutil = os.path.join(DART_DIR, 'third_party', 'gsutil', 'gsutil') | 222 dart_gsutil = os.path.join(DART_DIR, 'third_party', 'gsutil', 'gsutil') |
| 223 possible_locations = (list(os.environ['PATH'].split(os.pathsep)) | 223 if os.path.isfile(dart_gsutil): |
| 224 + [dart_gsutil]) | 224 GSUtil.GSUTIL_IS_SHELL_SCRIPT = False |
| 225 for directory in possible_locations: | 225 GSUtil.GSUTIL_PATH = dart_gsutil |
| 226 location = os.path.join(directory, 'gsutil') | 226 elif GSUtil.USE_DART_REPO_VERSION: |
| 227 if os.path.isfile(location): | 227 raise Exception("Requiring to use dart repo version of gsutil," |
|
Bill Hesse
2014/03/07 12:19:53
Dart repository version of gsutil required, but no
ricow1
2014/03/07 12:30:15
Done.
| |
| 228 GSUtil.GSUTIL_IS_SHELL_SCRIPT = False | 228 " but not found.") |
| 229 GSUtil.GSUTIL_PATH = location | 229 else: |
| 230 break | 230 # We did not find gsutil, look in path |
| 231 possible_locations = list(os.environ['PATH'].split(os.pathsep)) | |
| 232 for directory in possible_locations: | |
| 233 location = os.path.join(directory, 'gsutil') | |
| 234 if os.path.isfile(location): | |
| 235 GSUtil.GSUTIL_IS_SHELL_SCRIPT = False | |
| 236 GSUtil.GSUTIL_PATH = location | |
| 237 break | |
| 231 assert GSUtil.GSUTIL_PATH | 238 assert GSUtil.GSUTIL_PATH |
| 232 | 239 |
| 233 def execute(self, gsutil_args): | 240 def execute(self, gsutil_args): |
| 234 self._layzCalculateGSUtilPath() | 241 self._layzCalculateGSUtilPath() |
| 235 | 242 |
| 236 env = dict(os.environ) | 243 env = dict(os.environ) |
| 237 # If we're on the buildbot, we use a specific boto file. | 244 # If we're on the buildbot, we use a specific boto file. |
| 238 if utils.GetUserName() == 'chrome-bot': | 245 if utils.GetUserName() == 'chrome-bot': |
| 239 boto_config = { | 246 boto_config = { |
| 240 'linux': '/mnt/data/b/build/site_config/.boto', | 247 'linux': '/mnt/data/b/build/site_config/.boto', |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 298 if not mangled_filename: | 305 if not mangled_filename: |
| 299 mangled_filename = os.path.basename(filename) | 306 mangled_filename = os.path.basename(filename) |
| 300 | 307 |
| 301 checksum = CalculateChecksum(filename) | 308 checksum = CalculateChecksum(filename) |
| 302 checksum_filename = '%s.md5sum' % filename | 309 checksum_filename = '%s.md5sum' % filename |
| 303 | 310 |
| 304 with open(checksum_filename, 'w') as f: | 311 with open(checksum_filename, 'w') as f: |
| 305 f.write('%s *%s' % (checksum, mangled_filename)) | 312 f.write('%s *%s' % (checksum, mangled_filename)) |
| 306 | 313 |
| 307 return checksum_filename | 314 return checksum_filename |
| OLD | NEW |