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 subprocess | 10 import subprocess |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 assert mode in Mode.ALL_MODES | 158 assert mode in Mode.ALL_MODES |
| 159 return 'dartsdk-%s-%s-%s.zip' % ( | 159 return 'dartsdk-%s-%s-%s.zip' % ( |
| 160 SYSTEM_RENAMES[system], ARCH_RENAMES[arch], mode) | 160 SYSTEM_RENAMES[system], ARCH_RENAMES[arch], mode) |
| 161 | 161 |
| 162 def dartium_variant_zipfilename(self, name, system, arch, mode): | 162 def dartium_variant_zipfilename(self, name, system, arch, mode): |
| 163 assert name in ['chromedriver', 'dartium', 'content_shell'] | 163 assert name in ['chromedriver', 'dartium', 'content_shell'] |
| 164 assert mode in Mode.ALL_MODES | 164 assert mode in Mode.ALL_MODES |
| 165 return '%s-%s-%s-%s.zip' % ( | 165 return '%s-%s-%s-%s.zip' % ( |
| 166 name, SYSTEM_RENAMES[system], ARCH_RENAMES[arch], mode) | 166 name, SYSTEM_RENAMES[system], ARCH_RENAMES[arch], mode) |
| 167 | 167 |
| 168 class GCSNamerApiDocs(object): | |
| 169 def __init__(self, channel=Channel.BLEEDING_EDGE): | |
| 170 assert channel in Channel.ALL_CHANNELS | |
| 171 | |
| 172 self.channel = channel | |
| 173 self.bucket = 'gs://dartlang-api-docs' | |
| 174 | |
| 175 def docs_dirpath(self, revision): | |
| 176 assert len('%s' % revision) > 0 | |
| 177 return '%s/channels/%s/%s' % (self.bucket, self.channel, | |
| 178 revision) | |
|
ricow1
2013/11/08 12:17:18
move revision up, that easily fits
kustermann
2013/11/08 12:31:32
Done.
| |
| 179 | |
| 180 def docs_latestpath(self, revision): | |
| 181 assert len('%s' % revision) > 0 | |
| 182 return '%s/channels/%s/latest.txt' % (self.bucket, self.channel) | |
| 183 | |
| 168 def run(command, env=None, shell=False): | 184 def run(command, env=None, shell=False): |
| 169 print "Running command: ", command | 185 print "Running command: ", command |
| 170 | 186 |
| 171 p = subprocess.Popen(command, stdout=subprocess.PIPE, | 187 p = subprocess.Popen(command, stdout=subprocess.PIPE, |
| 172 stderr=subprocess.PIPE, env=env, shell=shell) | 188 stderr=subprocess.PIPE, env=env, shell=shell) |
| 173 (stdout, stderr) = p.communicate() | 189 (stdout, stderr) = p.communicate() |
| 174 if p.returncode != 0: | 190 if p.returncode != 0: |
| 175 print >> sys.stderr, "Failed to execute '%s'. Exit code: %s." % ( | 191 print >> sys.stderr, "Failed to execute '%s'. Exit code: %s." % ( |
| 176 command, p.returncode) | 192 command, p.returncode) |
| 177 print >> sys.stderr, "stdout: ", stdout | 193 print >> sys.stderr, "stdout: ", stdout |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 260 if not mangled_filename: | 276 if not mangled_filename: |
| 261 mangled_filename = os.path.basename(filename) | 277 mangled_filename = os.path.basename(filename) |
| 262 | 278 |
| 263 checksum = CalculateChecksum(filename) | 279 checksum = CalculateChecksum(filename) |
| 264 checksum_filename = '%s.md5sum' % filename | 280 checksum_filename = '%s.md5sum' % filename |
| 265 | 281 |
| 266 with open(checksum_filename, 'w') as f: | 282 with open(checksum_filename, 'w') as f: |
| 267 f.write('%s *%s' % (checksum, mangled_filename)) | 283 f.write('%s *%s' % (checksum, mangled_filename)) |
| 268 | 284 |
| 269 return checksum_filename | 285 return checksum_filename |
| OLD | NEW |