OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/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 # Run to install the necessary components to run webdriver on the buildbots or | 7 # Run to install the necessary components to run webdriver on the buildbots or |
8 # on your local machine. | 8 # on your local machine. |
9 # Note: The setup steps can be done fairly easily by hand. This script is | 9 # Note: The setup steps can be done fairly easily by hand. This script is |
10 # intended to simply and reduce the time for setup since there are a fair number | 10 # intended to simply and reduce the time for setup since there are a fair number |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 accept_func: A function that takes the URL and the "current best" URL and | 289 accept_func: A function that takes the URL and the "current best" URL and |
290 determines if it is better than our current download url.""" | 290 determines if it is better than our current download url.""" |
291 self.latest = 0 | 291 self.latest = 0 |
292 self.rejection_func = rejection_func | 292 self.rejection_func = rejection_func |
293 self.accept_func = accept_func | 293 self.accept_func = accept_func |
294 | 294 |
295 def handle_starttag(self, tag, attrs): | 295 def handle_starttag(self, tag, attrs): |
296 """Find the latest version.""" | 296 """Find the latest version.""" |
297 if (tag == 'a' and attrs[0][0] == 'href' and | 297 if (tag == 'a' and attrs[0][0] == 'href' and |
298 self.rejection_func(attrs[0][1])): | 298 self.rejection_func(attrs[0][1])): |
299 self.latest = self.better_func(attrs[0][1], self.latest) | 299 self.latest = self.accept_func(attrs[0][1], self.latest) |
300 | 300 |
301 class OperaInstaller(object): | 301 class OperaInstaller(object): |
302 """Install from the Opera FTP website.""" | 302 """Install from the Opera FTP website.""" |
303 | 303 |
304 def find_latest_version(self, download_page, rejection_func, accept_func): | 304 def find_latest_version(self, download_page, rejection_func, accept_func): |
305 """Get the latest non-beta version. | 305 """Get the latest non-beta version. |
306 Arguments: | 306 Arguments: |
307 download_page: The initial page that lists all the download options. | 307 download_page: The initial page that lists all the download options. |
308 rejection_func: A function that accepts the value of the URL and determines | 308 rejection_func: A function that accepts the value of the URL and determines |
309 if it is of the type we are looking for. | 309 if it is of the type we are looking for. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 if not args.iedriver and platform.system() == 'Windows': | 399 if not args.iedriver and platform.system() == 'Windows': |
400 GoogleCodeInstaller('selenium', find_depot_tools_location(args.buildbot), | 400 GoogleCodeInstaller('selenium', find_depot_tools_location(args.buildbot), |
401 lambda x: 'IEDriverServer_Win32_%(version)s.zip' % x).run() | 401 lambda x: 'IEDriverServer_Win32_%(version)s.zip' % x).run() |
402 if not args.firefox: | 402 if not args.firefox: |
403 FirefoxInstaller().run() | 403 FirefoxInstaller().run() |
404 if not args.opera: | 404 if not args.opera: |
405 OperaInstaller().run() | 405 OperaInstaller().run() |
406 | 406 |
407 if __name__ == '__main__': | 407 if __name__ == '__main__': |
408 main() | 408 main() |
OLD | NEW |