Chromium Code Reviews| 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 platform | 10 import platform |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 self.release_type, revision, name) | 162 self.release_type, revision, name) |
| 163 | 163 |
| 164 # Functions for quering filenames | 164 # Functions for quering filenames |
| 165 | 165 |
| 166 def dartium_android_apk_filename(self, name, arch, mode): | 166 def dartium_android_apk_filename(self, name, arch, mode): |
| 167 return '%s-%s-%s.apk' % (name, arch, mode) | 167 return '%s-%s-%s.apk' % (name, arch, mode) |
| 168 | 168 |
| 169 def apidocs_zipfilename(self): | 169 def apidocs_zipfilename(self): |
| 170 return 'dart-api-docs.zip' | 170 return 'dart-api-docs.zip' |
| 171 | 171 |
| 172 def dartdocs_zipfilename(self): | |
| 173 return 'dartdocs-gen-api.zip' | |
| 174 | |
| 172 def editor_zipfilename(self, system, arch): | 175 def editor_zipfilename(self, system, arch): |
| 173 return 'darteditor-%s-%s.zip' % ( | 176 return 'darteditor-%s-%s.zip' % ( |
| 174 SYSTEM_RENAMES[system], ARCH_RENAMES[arch]) | 177 SYSTEM_RENAMES[system], ARCH_RENAMES[arch]) |
| 175 | 178 |
| 176 def editor_android_zipfilename(self): | 179 def editor_android_zipfilename(self): |
| 177 return 'android.zip' | 180 return 'android.zip' |
| 178 | 181 |
| 179 def editor_installer_filename(self, system, arch, extension): | 182 def editor_installer_filename(self, system, arch, extension): |
| 180 assert extension in ['dmg', 'msi'] | 183 assert extension in ['dmg', 'msi'] |
| 181 return 'darteditor-installer-%s-%s.%s' % ( | 184 return 'darteditor-installer-%s-%s.%s' % ( |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 196 def __init__(self, channel=Channel.BLEEDING_EDGE): | 199 def __init__(self, channel=Channel.BLEEDING_EDGE): |
| 197 assert channel in Channel.ALL_CHANNELS | 200 assert channel in Channel.ALL_CHANNELS |
| 198 | 201 |
| 199 self.channel = channel | 202 self.channel = channel |
| 200 self.bucket = 'gs://dartlang-api-docs' | 203 self.bucket = 'gs://dartlang-api-docs' |
| 201 | 204 |
| 202 def docs_dirpath(self, revision): | 205 def docs_dirpath(self, revision): |
| 203 assert len('%s' % revision) > 0 | 206 assert len('%s' % revision) > 0 |
| 204 return '%s/channels/%s/%s' % (self.bucket, self.channel, revision) | 207 return '%s/channels/%s/%s' % (self.bucket, self.channel, revision) |
| 205 | 208 |
| 209 def dartdocs_dirpath(self, revision): | |
| 210 assert len('%s' % revision) > 0 | |
| 211 return '%s/channels/%s/gen-dartdocs/%s' % (self.bucket, self.channel, revisi on) | |
|
ricow1
2015/06/15 07:09:30
long line
keertip
2015/06/15 16:14:32
Done.
| |
| 212 | |
| 206 def docs_latestpath(self, revision): | 213 def docs_latestpath(self, revision): |
| 207 assert len('%s' % revision) > 0 | 214 assert len('%s' % revision) > 0 |
| 208 return '%s/channels/%s/latest.txt' % (self.bucket, self.channel) | 215 return '%s/channels/%s/latest.txt' % (self.bucket, self.channel) |
| 209 | 216 |
| 210 def run(command, env=None, shell=False, throw_on_error=True): | 217 def run(command, env=None, shell=False, throw_on_error=True): |
| 211 print "Running command: ", command | 218 print "Running command: ", command |
| 212 | 219 |
| 213 p = subprocess.Popen(command, stdout=subprocess.PIPE, | 220 p = subprocess.Popen(command, stdout=subprocess.PIPE, |
| 214 stderr=subprocess.PIPE, env=env, shell=shell) | 221 stderr=subprocess.PIPE, env=env, shell=shell) |
| 215 (stdout, stderr) = p.communicate() | 222 (stdout, stderr) = p.communicate() |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 271 | 278 |
| 272 if GSUtil.GSUTIL_IS_SHELL_SCRIPT: | 279 if GSUtil.GSUTIL_IS_SHELL_SCRIPT: |
| 273 gsutil_command = [GSUtil.GSUTIL_PATH] | 280 gsutil_command = [GSUtil.GSUTIL_PATH] |
| 274 else: | 281 else: |
| 275 gsutil_command = [sys.executable, GSUtil.GSUTIL_PATH] | 282 gsutil_command = [sys.executable, GSUtil.GSUTIL_PATH] |
| 276 | 283 |
| 277 return run(gsutil_command + gsutil_args, env=env, | 284 return run(gsutil_command + gsutil_args, env=env, |
| 278 shell=(GSUtil.GSUTIL_IS_SHELL_SCRIPT and | 285 shell=(GSUtil.GSUTIL_IS_SHELL_SCRIPT and |
| 279 sys.platform == 'win32')) | 286 sys.platform == 'win32')) |
| 280 | 287 |
| 281 def upload(self, local_path, remote_path, recursive=False, public=False): | 288 def upload(self, local_path, remote_path, recursive=False, |
| 289 public=False, multithread=False): | |
|
ricow1
2015/06/15 07:09:30
we normally indent this after (
keertip
2015/06/15 16:14:32
Done.
| |
| 282 assert remote_path.startswith('gs://') | 290 assert remote_path.startswith('gs://') |
| 283 | 291 |
| 284 args = ['cp'] | 292 if multithread: |
| 293 args = ['-m', 'cp'] | |
| 294 else: | |
| 295 args = ['cp'] | |
| 285 if public: | 296 if public: |
| 286 args += ['-a', 'public-read'] | 297 args += ['-a', 'public-read'] |
| 287 if recursive: | 298 if recursive: |
| 288 args += ['-R'] | 299 args += ['-R'] |
| 289 args += [local_path, remote_path] | 300 args += [local_path, remote_path] |
| 290 self.execute(args) | 301 self.execute(args) |
| 291 | 302 |
| 292 def cat(self, remote_path): | 303 def cat(self, remote_path): |
| 293 assert remote_path.startswith('gs://') | 304 assert remote_path.startswith('gs://') |
| 294 | 305 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 365 | 376 |
| 366 return checksum_filename | 377 return checksum_filename |
| 367 | 378 |
| 368 def GetChannelFromName(name): | 379 def GetChannelFromName(name): |
| 369 """Get the channel from the name. Bleeding edge builders don't | 380 """Get the channel from the name. Bleeding edge builders don't |
| 370 have a suffix.""" | 381 have a suffix.""" |
| 371 channel_name = string.split(name, '-').pop() | 382 channel_name = string.split(name, '-').pop() |
| 372 if channel_name in Channel.ALL_CHANNELS: | 383 if channel_name in Channel.ALL_CHANNELS: |
| 373 return channel_name | 384 return channel_name |
| 374 return Channel.BLEEDING_EDGE | 385 return Channel.BLEEDING_EDGE |
| OLD | NEW |