| 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 print >> sys.stderr, "Failed to execute '%s'. Exit code: %s." % ( | 203 print >> sys.stderr, "Failed to execute '%s'. Exit code: %s." % ( |
| 204 command, p.returncode) | 204 command, p.returncode) |
| 205 print >> sys.stderr, "stdout: ", stdout | 205 print >> sys.stderr, "stdout: ", stdout |
| 206 print >> sys.stderr, "stderr: ", stderr | 206 print >> sys.stderr, "stderr: ", stderr |
| 207 raise Exception("Failed to execute %s." % command) | 207 raise Exception("Failed to execute %s." % command) |
| 208 return (stdout, stderr, p.returncode) | 208 return (stdout, stderr, p.returncode) |
| 209 | 209 |
| 210 class GSUtil(object): | 210 class GSUtil(object): |
| 211 GSUTIL_IS_SHELL_SCRIPT = False | 211 GSUTIL_IS_SHELL_SCRIPT = False |
| 212 GSUTIL_PATH = None | 212 GSUTIL_PATH = None |
| 213 USE_DART_REPO_VERSION = False |
| 213 | 214 |
| 214 def _layzCalculateGSUtilPath(self): | 215 def _layzCalculateGSUtilPath(self): |
| 215 if not GSUtil.GSUTIL_PATH: | 216 if not GSUtil.GSUTIL_PATH: |
| 216 buildbot_gsutil = utils.GetBuildbotGSUtilPath() | 217 buildbot_gsutil = utils.GetBuildbotGSUtilPath() |
| 217 if os.path.isfile(buildbot_gsutil): | 218 if os.path.isfile(buildbot_gsutil) and not GSUtil.USE_DART_REPO_VERSION: |
| 218 GSUtil.GSUTIL_IS_SHELL_SCRIPT = True | 219 GSUtil.GSUTIL_IS_SHELL_SCRIPT = True |
| 219 GSUtil.GSUTIL_PATH = buildbot_gsutil | 220 GSUtil.GSUTIL_PATH = buildbot_gsutil |
| 220 else: | 221 else: |
| 221 dart_gsutil = os.path.join(DART_DIR, 'third_party', 'gsutil', 'gsutil') | 222 dart_gsutil = os.path.join(DART_DIR, 'third_party', 'gsutil', 'gsutil') |
| 222 possible_locations = (list(os.environ['PATH'].split(os.pathsep)) | 223 possible_locations = (list(os.environ['PATH'].split(os.pathsep)) |
| 223 + [dart_gsutil]) | 224 + [dart_gsutil]) |
| 224 for directory in possible_locations: | 225 for directory in possible_locations: |
| 225 location = os.path.join(directory, 'gsutil') | 226 location = os.path.join(directory, 'gsutil') |
| 226 if os.path.isfile(location): | 227 if os.path.isfile(location): |
| 227 GSUtil.GSUTIL_IS_SHELL_SCRIPT = False | 228 GSUtil.GSUTIL_IS_SHELL_SCRIPT = False |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 if not mangled_filename: | 298 if not mangled_filename: |
| 298 mangled_filename = os.path.basename(filename) | 299 mangled_filename = os.path.basename(filename) |
| 299 | 300 |
| 300 checksum = CalculateChecksum(filename) | 301 checksum = CalculateChecksum(filename) |
| 301 checksum_filename = '%s.md5sum' % filename | 302 checksum_filename = '%s.md5sum' % filename |
| 302 | 303 |
| 303 with open(checksum_filename, 'w') as f: | 304 with open(checksum_filename, 'w') as f: |
| 304 f.write('%s *%s' % (checksum, mangled_filename)) | 305 f.write('%s *%s' % (checksum, mangled_filename)) |
| 305 | 306 |
| 306 return checksum_filename | 307 return checksum_filename |
| OLD | NEW |