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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 """Depot_tools is our default install location for chromedriver, so we find | 50 """Depot_tools is our default install location for chromedriver, so we find |
51 its location on the filesystem. | 51 its location on the filesystem. |
52 Arguments: | 52 Arguments: |
53 is_buildbot - True if we are running buildbot machine setup (we can't detect | 53 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). | 54 this automatically because this script is not run at build time). |
55 """ | 55 """ |
56 if is_buildbot: | 56 if is_buildbot: |
57 depot_tools = os.path.join('b', 'depot_tools') | 57 depot_tools = os.path.join('b', 'depot_tools') |
58 if 'win32' in sys.platform or 'cygwin' in sys.platform: | 58 if 'win32' in sys.platform or 'cygwin' in sys.platform: |
59 depot_tools = os.path.join('e:', depot_tools) | 59 depot_tools = os.path.join('e:', depot_tools) |
60 depot_tools = '/Users/efortuna' | |
Emily Fortuna
2012/04/13 23:59:04
Super huge yikes here! I'm guessing this was a str
| |
61 return depot_tools | 60 return depot_tools |
62 else: | 61 else: |
63 path = os.environ['PATH'].split(os.pathsep) | 62 path = os.environ['PATH'].split(os.pathsep) |
64 for loc in path: | 63 for loc in path: |
65 if 'depot_tools' in loc: | 64 if 'depot_tools' in loc: |
66 return loc | 65 return loc |
67 raise Exception("Could not find depot_tools in your path.") | 66 raise Exception("Could not find depot_tools in your path.") |
68 | 67 |
69 | 68 |
70 class GoogleCodeInstaller(object): | 69 class GoogleCodeInstaller(object): |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 | 202 |
204 SETUPTOOLS_SITE = 'http://python-distribute.org/distribute_setup.py' | 203 SETUPTOOLS_SITE = 'http://python-distribute.org/distribute_setup.py' |
205 PIP_SITE = 'https://raw.github.com/pypa/pip/master/contrib/get-pip.py' | 204 PIP_SITE = 'https://raw.github.com/pypa/pip/master/contrib/get-pip.py' |
206 def __init__(self, is_buildbot): | 205 def __init__(self, is_buildbot): |
207 self.is_buildbot = is_buildbot | 206 self.is_buildbot = is_buildbot |
208 | 207 |
209 def run(self): | 208 def run(self): |
210 print 'Installing Selenium Python Bindings' | 209 print 'Installing Selenium Python Bindings' |
211 admin_keyword = '' | 210 admin_keyword = '' |
212 python_cmd = 'python' | 211 python_cmd = 'python' |
212 pip_cmd = 'pip' | |
213 if 'win32' not in sys.platform and 'cygwin' not in sys.platform: | 213 if 'win32' not in sys.platform and 'cygwin' not in sys.platform: |
214 admin_keyword = 'sudo' | 214 admin_keyword = 'sudo' |
215 else: | 215 else: |
216 # The python installation is "special" on Windows buildbots. | 216 # The python installation is "special" on Windows buildbots. |
217 if self.is_buildbot: | 217 if self.is_buildbot: |
218 python_cmd = os.path.join(find_depot_tools_location(self.is_buildbot), | 218 python_loc = os.path.join( |
219 'python-bin', 'python') | 219 find_depot_tools_location(self.is_buildbot), 'python-bin') |
220 python_cmd = os.path.join(python_loc, 'python') | |
221 pip_cmd = os.path.join(python_loc, 'Scripts', pip_cmd) | |
222 else: | |
223 path = os.environ['PATH'].split(os.pathsep) | |
224 for loc in path: | |
225 if 'python' in loc or 'Python' in loc: | |
226 pip_cmd = os.path.join(loc, 'Scripts', pip_cmd) | |
227 break | |
220 page = urllib2.urlopen(self.SETUPTOOLS_SITE) | 228 page = urllib2.urlopen(self.SETUPTOOLS_SITE) |
221 run_cmd('%s %s' % (admin_keyword, python_cmd), page.read()) | 229 run_cmd('%s %s' % (admin_keyword, python_cmd), page.read()) |
222 page = urllib2.urlopen(self.PIP_SITE) | 230 page = urllib2.urlopen(self.PIP_SITE) |
223 run_cmd('%s %s' % (admin_keyword, python_cmd), page.read()) | 231 run_cmd('%s %s' % (admin_keyword, python_cmd), page.read()) |
224 run_cmd('%s pip install -U selenium' % admin_keyword) | 232 run_cmd('%s %s install -U selenium' % (admin_keyword, pip_cmd)) |
225 | 233 |
226 def main(): | 234 def main(): |
227 args = parse_args() | 235 args = parse_args() |
228 SeleniumBindingsInstaller(args.buildbot).run() | 236 SeleniumBindingsInstaller(args.buildbot).run() |
229 chromedriver_loc = find_depot_tools_location(args.buildbot) | 237 chromedriver_loc = find_depot_tools_location(args.buildbot) |
230 if args.path: | 238 if args.path: |
231 chromedriver_loc = args.path | 239 chromedriver_loc = args.path |
232 GoogleCodeInstaller('chromedriver', chromedriver_loc, | 240 GoogleCodeInstaller('chromedriver', chromedriver_loc, |
233 lambda x: 'chromedriver_%(os)s_%(version)s.zip' % x).run() | 241 lambda x: 'chromedriver_%(os)s_%(version)s.zip' % x).run() |
234 if 'darwin' in sys.platform: | 242 if 'win32' not in sys.platform and 'cygwin' not in sys.platform: |
235 GoogleCodeInstaller('selenium', os.path.dirname(os.path.abspath(__file__)), | 243 GoogleCodeInstaller('selenium', os.path.dirname(os.path.abspath(__file__)), |
236 lambda x: 'selenium-server-standalone-%(version)s.jar' % x).run() | 244 lambda x: 'selenium-server-standalone-%(version)s.jar' % x).run() |
237 | 245 |
238 if args.firefox: | 246 if args.firefox: |
239 FirefoxInstaller().run() | 247 FirefoxInstaller().run() |
240 | 248 |
241 if __name__ == '__main__': | 249 if __name__ == '__main__': |
242 main() | 250 main() |
OLD | NEW |