Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1135)

Side by Side Diff: tools/bots/bot_utils.py

Issue 184633008: Always use the dart repo version of gsutil for the apk upload (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/bots/dartium_android.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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))
Bill Hesse 2014/03/06 14:49:15 Are you sure that we want the dart_gsutil path aft
ricow1 2014/03/06 16:54:11 Yeah - this actually looks more complicated than n
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
228 GSUtil.GSUTIL_PATH = location 229 GSUtil.GSUTIL_PATH = location
229 break 230 break
230 assert GSUtil.GSUTIL_PATH 231 assert GSUtil.GSUTIL_PATH
231 232
232 def execute(self, gsutil_args): 233 def execute(self, gsutil_args):
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « no previous file | tools/bots/dartium_android.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698