| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 print >> sys.stderr, "stdout: ", stdout | 142 print >> sys.stderr, "stdout: ", stdout |
| 143 print >> sys.stderr, "stderr: ", stderr | 143 print >> sys.stderr, "stderr: ", stderr |
| 144 raise Exception("Failed to execute %s." % command) | 144 raise Exception("Failed to execute %s." % command) |
| 145 | 145 |
| 146 class GSUtil(object): | 146 class GSUtil(object): |
| 147 GSUTIL_IS_SHELL_SCRIPT = False | 147 GSUTIL_IS_SHELL_SCRIPT = False |
| 148 GSUTIL_PATH = None | 148 GSUTIL_PATH = None |
| 149 | 149 |
| 150 def _layzCalculateGSUtilPath(self): | 150 def _layzCalculateGSUtilPath(self): |
| 151 if not GSUtil.GSUTIL_PATH: | 151 if not GSUtil.GSUTIL_PATH: |
| 152 buildbot_gsutil = os.path.dirname(utils.GetBuildbotGSUtilPath()) | 152 buildbot_gsutil = utils.GetBuildbotGSUtilPath() |
| 153 if os.path.isfile(buildbot_gsutil): | 153 if os.path.isfile(buildbot_gsutil): |
| 154 GSUtil.GSUTIL_IS_SHELL_SCRIPT = True | 154 GSUtil.GSUTIL_IS_SHELL_SCRIPT = True |
| 155 GSUtil.GSUTIL_PATH = buildbot_gsutil | 155 GSUtil.GSUTIL_PATH = buildbot_gsutil |
| 156 else: | 156 else: |
| 157 dart_gsutil = os.path.join(DART_DIR, 'third_party', 'gsutil', 'gsutil') | 157 dart_gsutil = os.path.join(DART_DIR, 'third_party', 'gsutil', 'gsutil') |
| 158 possible_locations = (list(os.environ['PATH'].split(os.pathsep)) | 158 possible_locations = (list(os.environ['PATH'].split(os.pathsep)) |
| 159 + [dart_gsutil]) | 159 + [dart_gsutil]) |
| 160 for directory in possible_locations: | 160 for directory in possible_locations: |
| 161 location = os.path.join(directory, 'gsutil') | 161 location = os.path.join(directory, 'gsutil') |
| 162 if os.path.isfile(location): | 162 if os.path.isfile(location): |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 mangled_filename = os.path.basename(filename) | 225 mangled_filename = os.path.basename(filename) |
| 226 | 226 |
| 227 checksum = CalculateChecksum(filename) | 227 checksum = CalculateChecksum(filename) |
| 228 checksum_filename = '%s.md5sum' % filename | 228 checksum_filename = '%s.md5sum' % filename |
| 229 | 229 |
| 230 with open(checksum_filename, 'w') as f: | 230 with open(checksum_filename, 'w') as f: |
| 231 f.write('%s *%s' % (checksum, mangled_filename)) | 231 f.write('%s *%s' % (checksum, mangled_filename)) |
| 232 | 232 |
| 233 return checksum_filename | 233 return checksum_filename |
| 234 | 234 |
| OLD | NEW |