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 21 matching lines...) Expand all Loading... |
32 output, stderr = p.communicate(input=stdin) | 32 output, stderr = p.communicate(input=stdin) |
33 if output: | 33 if output: |
34 print output | 34 print output |
35 if stderr: | 35 if stderr: |
36 print stderr | 36 print stderr |
37 | 37 |
38 def parse_args(): | 38 def parse_args(): |
39 parser = optparse.OptionParser() | 39 parser = optparse.OptionParser() |
40 parser.add_option('--firefox', '-f', dest='firefox', help='Install Firefox', | 40 parser.add_option('--firefox', '-f', dest='firefox', help='Install Firefox', |
41 action='store_true', default=False) | 41 action='store_true', default=False) |
42 parser.add_option('--path', '-p', dest='path', help='Specify location ' + \ | |
43 'on your PATH for where we should install chromedriver (default is in' + \ | |
44 'depot_tools).', metavar='CHROMEDRIVER_LOC', type='str', action='store', | |
45 default=None) | |
46 parser.add_option('--buildbot', '-b', dest='buildbot', action='store_true', | 42 parser.add_option('--buildbot', '-b', dest='buildbot', action='store_true', |
47 help='Perform a buildbot selenium setup (buildbots have a different' + \ | 43 help='Perform a buildbot selenium setup (buildbots have a different' + \ |
48 'location for their python executable).', default=False) | 44 'location for their python executable).', default=False) |
49 args, ignored = parser.parse_args() | 45 args, ignored = parser.parse_args() |
50 return args | 46 return args |
51 | 47 |
52 def find_depot_tools_location(is_buildbot): | 48 def find_depot_tools_location(is_buildbot): |
53 """Depot_tools is our default install location for chromedriver, so we find | 49 """Depot_tools is our default install location for chromedriver, so we find |
54 its location on the filesystem. | 50 its location on the filesystem. |
55 Arguments: | 51 Arguments: |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 break | 234 break |
239 page = urllib2.urlopen(self.SETUPTOOLS_SITE) | 235 page = urllib2.urlopen(self.SETUPTOOLS_SITE) |
240 run_cmd('%s %s' % (admin_keyword, python_cmd), page.read()) | 236 run_cmd('%s %s' % (admin_keyword, python_cmd), page.read()) |
241 page = urllib2.urlopen(self.PIP_SITE) | 237 page = urllib2.urlopen(self.PIP_SITE) |
242 run_cmd('%s %s' % (admin_keyword, python_cmd), page.read()) | 238 run_cmd('%s %s' % (admin_keyword, python_cmd), page.read()) |
243 run_cmd('%s %s install -U selenium' % (admin_keyword, pip_cmd)) | 239 run_cmd('%s %s install -U selenium' % (admin_keyword, pip_cmd)) |
244 | 240 |
245 def main(): | 241 def main(): |
246 args = parse_args() | 242 args = parse_args() |
247 SeleniumBindingsInstaller(args.buildbot).run() | 243 SeleniumBindingsInstaller(args.buildbot).run() |
248 chromedriver_loc = find_depot_tools_location(args.buildbot) | 244 GoogleCodeInstaller('chromedriver', ind_depot_tools_location(args.buildbot), |
249 if args.path: | |
250 chromedriver_loc = args.path | |
251 GoogleCodeInstaller('chromedriver', chromedriver_loc, | |
252 lambda x: 'chromedriver_%(os)s_%(version)s.zip' % x).run() | 245 lambda x: 'chromedriver_%(os)s_%(version)s.zip' % x).run() |
253 if 'win32' not in sys.platform and 'cygwin' not in sys.platform: | 246 if 'win32' not in sys.platform and 'cygwin' not in sys.platform: |
254 GoogleCodeInstaller('selenium', os.path.dirname(os.path.abspath(__file__)), | 247 GoogleCodeInstaller('selenium', os.path.dirname(os.path.abspath(__file__)), |
255 lambda x: 'selenium-server-standalone-%(version)s.jar' % x).run() | 248 lambda x: 'selenium-server-standalone-%(version)s.jar' % x).run() |
256 | 249 |
257 if args.firefox: | 250 if args.firefox: |
258 FirefoxInstaller().run() | 251 FirefoxInstaller().run() |
259 | 252 |
260 if __name__ == '__main__': | 253 if __name__ == '__main__': |
261 main() | 254 main() |
OLD | NEW |