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