| 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 | |
| 214 | 213 |
| 215 def _layzCalculateGSUtilPath(self): | 214 def _layzCalculateGSUtilPath(self): |
| 216 if not GSUtil.GSUTIL_PATH: | 215 if not GSUtil.GSUTIL_PATH: |
| 217 buildbot_gsutil = utils.GetBuildbotGSUtilPath() | 216 buildbot_gsutil = utils.GetBuildbotGSUtilPath() |
| 218 if os.path.isfile(buildbot_gsutil) and not GSUtil.USE_DART_REPO_VERSION: | 217 if os.path.isfile(buildbot_gsutil): |
| 219 GSUtil.GSUTIL_IS_SHELL_SCRIPT = True | 218 GSUtil.GSUTIL_IS_SHELL_SCRIPT = True |
| 220 GSUtil.GSUTIL_PATH = buildbot_gsutil | 219 GSUtil.GSUTIL_PATH = buildbot_gsutil |
| 221 else: | 220 else: |
| 222 dart_gsutil = os.path.join(DART_DIR, 'third_party', 'gsutil', 'gsutil') | 221 dart_gsutil = os.path.join(DART_DIR, 'third_party', 'gsutil', 'gsutil') |
| 223 possible_locations = (list(os.environ['PATH'].split(os.pathsep)) | 222 possible_locations = (list(os.environ['PATH'].split(os.pathsep)) |
| 224 + [dart_gsutil]) | 223 + [dart_gsutil]) |
| 225 for directory in possible_locations: | 224 for directory in possible_locations: |
| 226 location = os.path.join(directory, 'gsutil') | 225 location = os.path.join(directory, 'gsutil') |
| 227 if os.path.isfile(location): | 226 if os.path.isfile(location): |
| 228 GSUtil.GSUTIL_IS_SHELL_SCRIPT = False | 227 GSUtil.GSUTIL_IS_SHELL_SCRIPT = False |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 if not mangled_filename: | 297 if not mangled_filename: |
| 299 mangled_filename = os.path.basename(filename) | 298 mangled_filename = os.path.basename(filename) |
| 300 | 299 |
| 301 checksum = CalculateChecksum(filename) | 300 checksum = CalculateChecksum(filename) |
| 302 checksum_filename = '%s.md5sum' % filename | 301 checksum_filename = '%s.md5sum' % filename |
| 303 | 302 |
| 304 with open(checksum_filename, 'w') as f: | 303 with open(checksum_filename, 'w') as f: |
| 305 f.write('%s *%s' % (checksum, mangled_filename)) | 304 f.write('%s *%s' % (checksum, mangled_filename)) |
| 306 | 305 |
| 307 return checksum_filename | 306 return checksum_filename |
| OLD | NEW |