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

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

Issue 24048004: Run gsutil in the cmd.exe shell on windows (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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 | no next file » | 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 assert mode in Mode.ALL_MODES 124 assert mode in Mode.ALL_MODES
125 return 'dartsdk-%s-%s-%s.zip' % ( 125 return 'dartsdk-%s-%s-%s.zip' % (
126 SYSTEM_RENAMES[system], ARCH_RENAMES[arch], mode) 126 SYSTEM_RENAMES[system], ARCH_RENAMES[arch], mode)
127 127
128 def dartium_variant_zipfilename(self, name, system, arch, mode): 128 def dartium_variant_zipfilename(self, name, system, arch, mode):
129 assert name in ['chromedriver', 'dartium', 'content_shell'] 129 assert name in ['chromedriver', 'dartium', 'content_shell']
130 assert mode in Mode.ALL_MODES 130 assert mode in Mode.ALL_MODES
131 return '%s-%s-%s-%s.zip' % ( 131 return '%s-%s-%s-%s.zip' % (
132 name, SYSTEM_RENAMES[system], ARCH_RENAMES[arch], mode) 132 name, SYSTEM_RENAMES[system], ARCH_RENAMES[arch], mode)
133 133
134 def run(command, env=None): 134 def run(command, env=None, shell=False):
135 print "Running command: ", command 135 print "Running command: ", command
136
136 p = subprocess.Popen(command, stdout=subprocess.PIPE, 137 p = subprocess.Popen(command, stdout=subprocess.PIPE,
137 stderr=subprocess.PIPE, env=env) 138 stderr=subprocess.PIPE, env=env, shell=shell)
138 (stdout, stderr) = p.communicate() 139 (stdout, stderr) = p.communicate()
139 if p.returncode != 0: 140 if p.returncode != 0:
140 print >> sys.stderr, "Failed to execute '%s'. Exit code: %s." % ( 141 print >> sys.stderr, "Failed to execute '%s'. Exit code: %s." % (
141 command, p.returncode) 142 command, p.returncode)
142 print >> sys.stderr, "stdout: ", stdout 143 print >> sys.stderr, "stdout: ", stdout
143 print >> sys.stderr, "stderr: ", stderr 144 print >> sys.stderr, "stderr: ", stderr
144 raise Exception("Failed to execute %s." % command) 145 raise Exception("Failed to execute %s." % command)
145 146
146 class GSUtil(object): 147 class GSUtil(object):
147 GSUTIL_IS_SHELL_SCRIPT = False 148 GSUTIL_IS_SHELL_SCRIPT = False
(...skipping 29 matching lines...) Expand all
177 'win32': r'e:\b\build\site_config\.boto', 178 'win32': r'e:\b\build\site_config\.boto',
178 }[utils.GuessOS()] 179 }[utils.GuessOS()]
179 env['AWS_CREDENTIAL_FILE'] = boto_config 180 env['AWS_CREDENTIAL_FILE'] = boto_config
180 env['BOTO_CONFIG'] = boto_config 181 env['BOTO_CONFIG'] = boto_config
181 182
182 if GSUtil.GSUTIL_IS_SHELL_SCRIPT: 183 if GSUtil.GSUTIL_IS_SHELL_SCRIPT:
183 gsutil_command = [GSUtil.GSUTIL_PATH] 184 gsutil_command = [GSUtil.GSUTIL_PATH]
184 else: 185 else:
185 gsutil_command = [sys.executable, GSUtil.GSUTIL_PATH] 186 gsutil_command = [sys.executable, GSUtil.GSUTIL_PATH]
186 187
187 run(gsutil_command + gsutil_args, env=env) 188 run(gsutil_command + gsutil_args, env=env,
189 shell=GSUtil.GSUTIL_IS_SHELL_SCRIPT)
188 190
189 def upload(self, local_path, remote_path, recursive=False, public=False): 191 def upload(self, local_path, remote_path, recursive=False, public=False):
190 assert remote_path.startswith('gs://') 192 assert remote_path.startswith('gs://')
191 193
192 args = ['cp'] 194 args = ['cp']
193 if public: 195 if public:
194 args += ['-a', 'public-read'] 196 args += ['-a', 'public-read']
195 if recursive: 197 if recursive:
196 args += ['-R'] 198 args += ['-R']
197 args += [local_path, remote_path] 199 args += [local_path, remote_path]
(...skipping 26 matching lines...) Expand all
224 if not mangled_filename: 226 if not mangled_filename:
225 mangled_filename = os.path.basename(filename) 227 mangled_filename = os.path.basename(filename)
226 228
227 checksum = CalculateChecksum(filename) 229 checksum = CalculateChecksum(filename)
228 checksum_filename = '%s.md5sum' % filename 230 checksum_filename = '%s.md5sum' % filename
229 231
230 with open(checksum_filename, 'w') as f: 232 with open(checksum_filename, 'w') as f:
231 f.write('%s *%s' % (checksum, mangled_filename)) 233 f.write('%s *%s' % (checksum, mangled_filename))
232 234
233 return checksum_filename 235 return checksum_filename
234
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698