OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2011, 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 # Gets or updates a DumpRenderTree (a nearly headless build of chrome). This is | 7 # Gets or updates a DumpRenderTree (a nearly headless build of chrome). This is |
8 # used for running browser tests of client applications. | 8 # used for running browser tests of client applications. |
9 | 9 |
10 import json | 10 import json |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 directory: target directory (recreated) to install binary | 193 directory: target directory (recreated) to install binary |
194 version_file: name of file with the current version stamp | 194 version_file: name of file with the current version stamp |
195 latest_pattern: the google store url pattern pointing to the latest binary | 195 latest_pattern: the google store url pattern pointing to the latest binary |
196 permanent_prefix: stable google store folder used to download versions | 196 permanent_prefix: stable google store folder used to download versions |
197 revision_num: the desired revision number, or None for the most recent | 197 revision_num: the desired revision number, or None for the most recent |
198 """ | 198 """ |
199 osdict = {'Darwin':'macos', 'Linux':'linux', 'Windows':'win32'} | 199 osdict = {'Darwin':'macos', 'Linux':'linux', 'Windows':'win32'} |
200 def FindPermanentUrl(out, osname, not_used): | 200 def FindPermanentUrl(out, osname, not_used): |
201 rev_num = revision_num | 201 rev_num = revision_num |
202 if not rev_num: | 202 if not rev_num: |
203 temp_file = tempfile.NamedTemporaryFile() | 203 temp_file = tempfile.NamedTemporaryFile(delete=False) |
| 204 temp_file.close() |
204 temp_file_url = 'file://' + temp_file.name | 205 temp_file_url = 'file://' + temp_file.name |
205 Gsutil('cp', latest_pattern % {'osname' : osname }, temp_file_url) | 206 Gsutil('cp', latest_pattern % {'osname' : osname }, temp_file_url) |
| 207 temp_file = open(temp_file.name) |
206 temp_file.seek(0) | 208 temp_file.seek(0) |
207 version_info = temp_file.read() | 209 version_info = temp_file.read() |
208 temp_file.close() | 210 temp_file.close() |
| 211 os.unlink(temp_file.name) |
209 if version_info != '': | 212 if version_info != '': |
210 rev_num = json.loads(version_info)['revision'] | 213 rev_num = json.loads(version_info)['revision'] |
211 else: | 214 else: |
212 print 'Unable to get latest version information.' | 215 print 'Unable to get latest version information.' |
213 return '' | 216 return '' |
214 latest = (permanent_prefix % { 'osname' : osname, 'version_num': rev_num}) | 217 latest = (permanent_prefix % { 'osname' : osname, 'version_num': rev_num}) |
215 return latest | 218 return latest |
216 | 219 |
217 GetFromGsutil(name, directory, version_file, latest_pattern, osdict, | 220 GetFromGsutil(name, directory, version_file, latest_pattern, osdict, |
218 FindPermanentUrl, revision_num) | 221 FindPermanentUrl, revision_num) |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 GetDartiumRevision('DumpRenderTree', DRT_DIR, DRT_VERSION, | 350 GetDartiumRevision('DumpRenderTree', DRT_DIR, DRT_VERSION, |
348 DRT_LATEST_PATTERN, DRT_PERMANENT_PATTERN, | 351 DRT_LATEST_PATTERN, DRT_PERMANENT_PATTERN, |
349 args.revision) | 352 args.revision) |
350 CopyDrtFont(DRT_DIR) | 353 CopyDrtFont(DRT_DIR) |
351 else: | 354 else: |
352 print ('Please specify the target you wish to download from Google Storage ' | 355 print ('Please specify the target you wish to download from Google Storage ' |
353 '("drt", "dartium", "chromedriver", or "sdk")') | 356 '("drt", "dartium", "chromedriver", or "sdk")') |
354 | 357 |
355 if __name__ == '__main__': | 358 if __name__ == '__main__': |
356 sys.exit(main()) | 359 sys.exit(main()) |
OLD | NEW |