| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/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 # 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 f = urllib2.urlopen(google_code_site) | 101 f = urllib2.urlopen(google_code_site) |
| 102 latest = '' | 102 latest = '' |
| 103 for line in f.readlines(): | 103 for line in f.readlines(): |
| 104 if re.search(self.download_regex_str, line): | 104 if re.search(self.download_regex_str, line): |
| 105 suffix_index = line.find( | 105 suffix_index = line.find( |
| 106 self.download_regex_str[self.download_regex_str.rfind('.'):]) | 106 self.download_regex_str[self.download_regex_str.rfind('.'):]) |
| 107 name_end = self.download_regex_str.rfind('.+') | 107 name_end = self.download_regex_str.rfind('.+') |
| 108 name = self.download_name_func({'os': self.get_os_str, 'version': ''}) | 108 name = self.download_name_func({'os': self.get_os_str, 'version': ''}) |
| 109 name = name[:name.rfind('.')] | 109 name = name[:name.rfind('.')] |
| 110 version_str = line[line.find(name) + len(name) : suffix_index] | 110 version_str = line[line.find(name) + len(name) : suffix_index] |
| 111 orig_version_str = version_str |
| 112 if version_str.count('.') == 0: |
| 113 version_str = version_str.replace('_', '.') |
| 114 version_str = re.compile(r'[^\d.]+').sub('', version_str) |
| 111 if latest == '': | 115 if latest == '': |
| 112 latest = '0.' * version_str.count('.') | 116 latest = '0.' * version_str.count('.') |
| 113 latest += '0' | 117 latest += '0' |
| 118 orig_latest_str = latest |
| 119 else: |
| 120 orig_latest_str = latest |
| 121 latest = latest.replace('_', '.') |
| 122 latest = re.compile(r'[^\d.]+').sub('', latest) |
| 114 nums = version_str.split('.') | 123 nums = version_str.split('.') |
| 115 latest_nums = latest.split('.') | 124 latest_nums = latest.split('.') |
| 116 for (num, latest_num) in zip(nums, latest_nums): | 125 for (num, latest_num) in zip(nums, latest_nums): |
| 117 if int(num) > int(latest_num): | 126 if int(num) > int(latest_num): |
| 118 latest = version_str | 127 latest = orig_version_str |
| 119 break | 128 break |
| 129 else: |
| 130 latest = orig_latest_str |
| 120 if latest == '': | 131 if latest == '': |
| 121 raise Exception("Couldn't find the desired download on " + \ | 132 raise Exception("Couldn't find the desired download on " + \ |
| 122 ' %s.' % google_code_site) | 133 ' %s.' % google_code_site) |
| 123 return latest | 134 return latest |
| 124 | 135 |
| 125 def run(self): | 136 def run(self): |
| 126 """Download and install the Google Code.""" | 137 """Download and install the Google Code.""" |
| 127 print 'Installing from %s' % self.project_name | 138 print 'Installing from %s' % self.project_name |
| 128 os_str = self.get_os_str | 139 os_str = self.get_os_str |
| 129 version = self.find_latest_version() | 140 version = self.find_latest_version() |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 lambda x: 'chromedriver_%(os)s_%(version)s.zip' % x).run() | 269 lambda x: 'chromedriver_%(os)s_%(version)s.zip' % x).run() |
| 259 if 'win32' not in sys.platform and 'cygwin' not in sys.platform: | 270 if 'win32' not in sys.platform and 'cygwin' not in sys.platform: |
| 260 GoogleCodeInstaller('selenium', os.path.dirname(os.path.abspath(__file__)), | 271 GoogleCodeInstaller('selenium', os.path.dirname(os.path.abspath(__file__)), |
| 261 lambda x: 'selenium-server-standalone-%(version)s.jar' % x).run() | 272 lambda x: 'selenium-server-standalone-%(version)s.jar' % x).run() |
| 262 | 273 |
| 263 if args.firefox: | 274 if args.firefox: |
| 264 FirefoxInstaller().run() | 275 FirefoxInstaller().run() |
| 265 | 276 |
| 266 if __name__ == '__main__': | 277 if __name__ == '__main__': |
| 267 main() | 278 main() |
| OLD | NEW |