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 20 matching lines...) Expand all Loading... | |
31 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, | 31 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, |
32 stdin=subprocess.PIPE, shell=True) | 32 stdin=subprocess.PIPE, shell=True) |
33 output, stderr = p.communicate(input=stdin) | 33 output, stderr = p.communicate(input=stdin) |
34 if output: | 34 if output: |
35 print output | 35 print output |
36 if stderr: | 36 if stderr: |
37 print stderr | 37 print stderr |
38 | 38 |
39 def parse_args(): | 39 def parse_args(): |
40 parser = optparse.OptionParser() | 40 parser = optparse.OptionParser() |
41 parser.add_option('--firefox', '-f', dest='firefox', help='Install Firefox', | 41 parser.add_option('--firefox', '-f', dest='firefox', help="Don't install " |
42 "Firefox", action='store_true', default=False) | |
sra1
2012/08/18 02:59:02
This would look better if you put
help="xxx"
on
| |
43 parser.add_option('--chromedriver', '-c', dest='chromedriver', help="Don't " | |
44 "install chromedriver.", action='store_true', default=False) | |
45 parser.add_option('--seleniumrc', '-s', dest='seleniumrc', help="Don't " | |
46 "install the Selenium RC server (used for Safari and Opera tests).", | |
42 action='store_true', default=False) | 47 action='store_true', default=False) |
48 parser.add_option('--python', '-p', dest='python', help="Don't " | |
49 "install Selenium python bindings.", action='store_true', default=False) | |
43 parser.add_option('--buildbot', '-b', dest='buildbot', action='store_true', | 50 parser.add_option('--buildbot', '-b', dest='buildbot', action='store_true', |
44 help='Perform a buildbot selenium setup (buildbots have a different' + \ | 51 help='Perform a buildbot selenium setup (buildbots have a different' + \ |
sra1
2012/08/18 02:59:02
I think the + and \ are both unnecessary
| |
45 'location for their python executable).', default=False) | 52 'location for their python executable).', default=False) |
46 args, ignored = parser.parse_args() | 53 args, ignored = parser.parse_args() |
47 return args | 54 return args |
48 | 55 |
49 def find_depot_tools_location(is_buildbot): | 56 def find_depot_tools_location(is_buildbot): |
50 """Depot_tools is our default install location for chromedriver, so we find | 57 """Depot_tools is our default install location for chromedriver, so we find |
51 its location on the filesystem. | 58 its location on the filesystem. |
52 Arguments: | 59 Arguments: |
53 is_buildbot - True if we are running buildbot machine setup (we can't detect | 60 is_buildbot - True if we are running buildbot machine setup (we can't detect |
54 this automatically because this script is not run at build time). | 61 this automatically because this script is not run at build time). |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
257 pip_cmd = os.path.join(loc, 'Scripts', pip_cmd) | 264 pip_cmd = os.path.join(loc, 'Scripts', pip_cmd) |
258 break | 265 break |
259 page = urllib2.urlopen(self.SETUPTOOLS_SITE) | 266 page = urllib2.urlopen(self.SETUPTOOLS_SITE) |
260 run_cmd('%s %s' % (admin_keyword, python_cmd), page.read()) | 267 run_cmd('%s %s' % (admin_keyword, python_cmd), page.read()) |
261 page = urllib2.urlopen(self.PIP_SITE) | 268 page = urllib2.urlopen(self.PIP_SITE) |
262 run_cmd('%s %s' % (admin_keyword, python_cmd), page.read()) | 269 run_cmd('%s %s' % (admin_keyword, python_cmd), page.read()) |
263 run_cmd('%s %s install -U selenium' % (admin_keyword, pip_cmd)) | 270 run_cmd('%s %s install -U selenium' % (admin_keyword, pip_cmd)) |
264 | 271 |
265 def main(): | 272 def main(): |
266 args = parse_args() | 273 args = parse_args() |
267 SeleniumBindingsInstaller(args.buildbot).run() | 274 if not args.python: |
268 GoogleCodeInstaller('chromedriver', find_depot_tools_location(args.buildbot), | 275 SeleniumBindingsInstaller(args.buildbot).run() |
269 lambda x: 'chromedriver_%(os)s_%(version)s.zip' % x).run() | 276 if not args.chromedriver: |
270 if 'win32' not in sys.platform and 'cygwin' not in sys.platform: | 277 GoogleCodeInstaller('chromedriver', |
278 find_depot_tools_location(args.buildbot), | |
279 lambda x: 'chromedriver_%(os)s_%(version)s.zip' % x).run() | |
280 if not args.seleniumrc: | |
271 GoogleCodeInstaller('selenium', os.path.dirname(os.path.abspath(__file__)), | 281 GoogleCodeInstaller('selenium', os.path.dirname(os.path.abspath(__file__)), |
272 lambda x: 'selenium-server-standalone-%(version)s.jar' % x).run() | 282 lambda x: 'selenium-server-standalone-%(version)s.jar' % x).run() |
273 | 283 |
274 if args.firefox: | 284 if not args.firefox: |
275 FirefoxInstaller().run() | 285 FirefoxInstaller().run() |
276 | 286 |
277 if __name__ == '__main__': | 287 if __name__ == '__main__': |
278 main() | 288 main() |
OLD | NEW |