Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: tools/testing/webdriver_test_setup.py

Issue 14969023: Remove some whitespace from the webdriver setup script. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 # of steps. 11 # of steps.
12 12
13 # TODO(efortuna): Rewrite this script in Dart when the Process module has a 13 # TODO(efortuna): Rewrite this script in Dart when the Process module has a
14 # better high level API. 14 # better high level API.
15 import HTMLParser 15 import HTMLParser
16 import optparse 16 import optparse
17 import os 17 import os
18 import platform 18 import platform
19 import re 19 import re
20 import shutil 20 import shutil
21 import string 21 import string
22 import subprocess 22 import subprocess
23 import sys 23 import sys
24 import urllib 24 import urllib
25 import urllib2 25 import urllib2
26 import zipfile 26 import zipfile
27 27
28 def run_cmd(cmd, stdin=None): 28 def run_cmd(cmd, stdin=None):
29 """Run the command on the command line in the shell. We print the output of 29 """Run the command on the command line in the shell. We print the output of
30 the command. 30 the command.
31 """ 31 """
32 print cmd 32 print cmd
33 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, 33 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
34 stdin=subprocess.PIPE, shell=True) 34 stdin=subprocess.PIPE, shell=True)
35 output, stderr = p.communicate(input=stdin) 35 output, stderr = p.communicate(input=stdin)
36 if output: 36 if output:
37 print output 37 print output
38 if stderr: 38 if stderr:
39 print stderr 39 print stderr
40 40
41 def parse_args(): 41 def parse_args():
42 parser = optparse.OptionParser() 42 parser = optparse.OptionParser()
43 parser.add_option('--firefox', '-f', dest='firefox', 43 parser.add_option('--firefox', '-f', dest='firefox',
44 help="Don't install Firefox", action='store_true', default=False) 44 help="Don't install Firefox", action='store_true', default=False)
45 parser.add_option('--opera', '-o', dest='opera', default=False, 45 parser.add_option('--opera', '-o', dest='opera', default=False,
46 help="Don't install Opera", action='store_true') 46 help="Don't install Opera", action='store_true')
47 parser.add_option('--chromedriver', '-c', dest='chromedriver', 47 parser.add_option('--chromedriver', '-c', dest='chromedriver',
48 help="Don't install chromedriver.", action='store_true', default=False) 48 help="Don't install chromedriver.", action='store_true', default=False)
49 parser.add_option('--iedriver', '-i', dest='iedriver', 49 parser.add_option('--iedriver', '-i', dest='iedriver',
50 help="Don't install iedriver (only used on Windows).", 50 help="Don't install iedriver (only used on Windows).",
51 action='store_true', default=False) 51 action='store_true', default=False)
52 parser.add_option('--seleniumrc', '-s', dest='seleniumrc', 52 parser.add_option('--seleniumrc', '-s', dest='seleniumrc',
53 help="Don't install the Selenium RC server (used for Safari and Opera " 53 help="Don't install the Selenium RC server (used for Safari and Opera "
54 "tests).", action='store_true', default=False) 54 "tests).", action='store_true', default=False)
55 parser.add_option('--python', '-p', dest='python', 55 parser.add_option('--python', '-p', dest='python',
56 help="Don't install Selenium python bindings.", action='store_true', 56 help="Don't install Selenium python bindings.", action='store_true',
57 default=False) 57 default=False)
58 parser.add_option('--buildbot', '-b', dest='buildbot', action='store_true', 58 parser.add_option('--buildbot', '-b', dest='buildbot', action='store_true',
59 help='Perform a buildbot selenium setup (buildbots have a different' + 59 help='Perform a buildbot selenium setup (buildbots have a different' +
60 'location for their python executable).', default=False) 60 'location for their python executable).', default=False)
61 args, _ = parser.parse_args() 61 args, _ = parser.parse_args()
62 return args 62 return args
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 def google_code_downloads_page(self): 103 def google_code_downloads_page(self):
104 return 'http://code.google.com/p/%s/downloads/list' % self.project_name 104 return 'http://code.google.com/p/%s/downloads/list' % self.project_name
105 105
106 def google_code_download(self): 106 def google_code_download(self):
107 return 'http://%s.googlecode.com/files/' % self.project_name 107 return 'http://%s.googlecode.com/files/' % self.project_name
108 108
109 def find_latest_version(self): 109 def find_latest_version(self):
110 """Find the latest version number of some code available for download on a 110 """Find the latest version number of some code available for download on a
111 Google code page. This was unfortunately done in an ad hoc manner because 111 Google code page. This was unfortunately done in an ad hoc manner because
112 Google Code does not seem to have an API for their list of current 112 Google Code does not seem to have an API for their list of current
113 downloads(!). 113 downloads(!).
114 """ 114 """
115 google_code_site = self.google_code_downloads_page() 115 google_code_site = self.google_code_downloads_page()
116 f = urllib2.urlopen(google_code_site) 116 f = urllib2.urlopen(google_code_site)
117 latest = '' 117 latest = ''
118 for line in f.readlines(): 118 for line in f.readlines():
119 if re.search(self.download_regex_str, line): 119 if re.search(self.download_regex_str, line):
120 suffix_index = line.find( 120 suffix_index = line.find(
121 self.download_regex_str[self.download_regex_str.rfind('.'):]) 121 self.download_regex_str[self.download_regex_str.rfind('.'):])
122 name_end = self.download_regex_str.rfind('.+') 122 name_end = self.download_regex_str.rfind('.+')
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
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()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698