| 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 content shell (a nearly headless build of chrome). This is | 7 # Gets or updates a content shell (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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 return True | 93 return True |
| 94 | 94 |
| 95 return False | 95 return False |
| 96 | 96 |
| 97 | 97 |
| 98 def InRunhooks(): | 98 def InRunhooks(): |
| 99 """True if this script was called by "gclient runhooks" or "gclient sync\"""" | 99 """True if this script was called by "gclient runhooks" or "gclient sync\"""" |
| 100 return 'runhooks' in sys.argv | 100 return 'runhooks' in sys.argv |
| 101 | 101 |
| 102 | 102 |
| 103 def EnsureConfig(): | |
| 104 # If ~/.boto doesn't exist, tell the user to run "gsutil config" | |
| 105 if not HasBotoConfig(): | |
| 106 print >>sys.stderr, ''' | |
| 107 ******************************************************************************* | |
| 108 * WARNING: Can't download content shell! This is required to test client apps. | |
| 109 * You need to do a one-time configuration step to access Google Storage. | |
| 110 * Please run this command and follow the instructions: | |
| 111 * %s config | |
| 112 * | |
| 113 * NOTE: When prompted you can leave "project-id" blank. Just hit enter. | |
| 114 ******************************************************************************* | |
| 115 ''' % GSUTIL | |
| 116 sys.exit(1) | |
| 117 | |
| 118 | |
| 119 def GetDartiumRevision(name, bot, directory, version_file, latest_pattern, | 103 def GetDartiumRevision(name, bot, directory, version_file, latest_pattern, |
| 120 permanent_prefix, revision_num=None): | 104 permanent_prefix, revision_num=None): |
| 121 """Get the latest binary that is stored in the dartium archive. | 105 """Get the latest binary that is stored in the dartium archive. |
| 122 | 106 |
| 123 Args: | 107 Args: |
| 124 name: the name of the desired download. | 108 name: the name of the desired download. |
| 125 directory: target directory (recreated) to install binary | 109 directory: target directory (recreated) to install binary |
| 126 version_file: name of file with the current version stamp | 110 version_file: name of file with the current version stamp |
| 127 latest_pattern: the google store url pattern pointing to the latest binary | 111 latest_pattern: the google store url pattern pointing to the latest binary |
| 128 permanent_prefix: stable google store folder used to download versions | 112 permanent_prefix: stable google store folder used to download versions |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 the latest revision) | 212 the latest revision) |
| 229 """ | 213 """ |
| 230 system = platform.system() | 214 system = platform.system() |
| 231 try: | 215 try: |
| 232 osname = os_name_dict[system] | 216 osname = os_name_dict[system] |
| 233 except KeyError: | 217 except KeyError: |
| 234 print >>sys.stderr, ('WARNING: platform "%s" does not support' | 218 print >>sys.stderr, ('WARNING: platform "%s" does not support' |
| 235 '%s.') % (system, name) | 219 '%s.') % (system, name) |
| 236 return 0 | 220 return 0 |
| 237 | 221 |
| 238 EnsureConfig() | |
| 239 | |
| 240 # Query for the latest version | 222 # Query for the latest version |
| 241 pattern = latest_pattern % { 'osname' : osname, 'bot' : bot } | 223 pattern = latest_pattern % { 'osname' : osname, 'bot' : bot } |
| 242 result, out = Gsutil('ls', pattern) | 224 result, out = Gsutil('ls', pattern) |
| 243 if result == 0: | 225 if result == 0: |
| 244 # use permanent link instead, just in case the latest zip entry gets deleted | 226 # use permanent link instead, just in case the latest zip entry gets deleted |
| 245 # while we are downloading it. | 227 # while we are downloading it. |
| 246 latest = get_permanent_url(out, osname, revision_num) | 228 latest = get_permanent_url(out, osname, revision_num) |
| 247 else: # e.g. no access | 229 else: # e.g. no access |
| 248 print "Couldn't download %s: %s\n%s" % (name, pattern, out) | 230 print "Couldn't download %s: %s\n%s" % (name, pattern, out) |
| 249 if not os.path.exists(version_file): | 231 if not os.path.exists(version_file): |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 GetDartiumRevision('content_shell', bot, DRT_DIR, DRT_VERSION, | 332 GetDartiumRevision('content_shell', bot, DRT_DIR, DRT_VERSION, |
| 351 DRT_LATEST_PATTERN, DRT_PERMANENT_PATTERN, | 333 DRT_LATEST_PATTERN, DRT_PERMANENT_PATTERN, |
| 352 args.revision) | 334 args.revision) |
| 353 CopyDrtFont(DRT_DIR) | 335 CopyDrtFont(DRT_DIR) |
| 354 else: | 336 else: |
| 355 print ('Please specify the target you wish to download from Google Storage ' | 337 print ('Please specify the target you wish to download from Google Storage ' |
| 356 '("drt", "dartium", "chromedriver", or "sdk")') | 338 '("drt", "dartium", "chromedriver", or "sdk")') |
| 357 | 339 |
| 358 if __name__ == '__main__': | 340 if __name__ == '__main__': |
| 359 sys.exit(main()) | 341 sys.exit(main()) |
| OLD | NEW |