| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 def run(self): | 128 def run(self): |
| 129 """Download and install the Google Code.""" | 129 """Download and install the Google Code.""" |
| 130 print 'Installing from %s' % self.project_name | 130 print 'Installing from %s' % self.project_name |
| 131 os_str = self.get_os_str | 131 os_str = self.get_os_str |
| 132 version = self.find_latest_version() | 132 version = self.find_latest_version() |
| 133 download_name = self.download_name_func({'os': os_str, 'version': version}) | 133 download_name = self.download_name_func({'os': os_str, 'version': version}) |
| 134 urllib.urlretrieve(self.google_code_download() + '/' + download_name, | 134 urllib.urlretrieve(self.google_code_download() + '/' + download_name, |
| 135 os.path.join(self.download_location, download_name)) | 135 os.path.join(self.download_location, download_name)) |
| 136 if download_name.endswith('.zip'): | 136 if download_name.endswith('.zip'): |
| 137 z = zipfile.ZipFile(os.path.join(self.download_location, download_name)) | 137 if platform.system() != 'Windows': |
| 138 z.extractall(self.download_location) | 138 # The Python zip utility does not preserve executable permissions, but |
| 139 z.close() | 139 # this does not seem to be a problem for Windows, which does not have a |
| 140 # built in zip utility. :-/ |
| 141 run_cmd('unzip -u %s -d %s' % (os.path.join(self.download_location, |
| 142 download_name), self.download_location)) |
| 143 else: |
| 144 z = zipfile.ZipFile(os.path.join(self.download_location, download_name)) |
| 145 z.extractall(self.download_location) |
| 146 z.close() |
| 140 os.remove(os.path.join(self.download_location, download_name)) | 147 os.remove(os.path.join(self.download_location, download_name)) |
| 141 | 148 |
| 142 @property | 149 @property |
| 143 def get_os_str(self): | 150 def get_os_str(self): |
| 144 """The strings to indicate what OS a download is for as used on Google Code. | 151 """The strings to indicate what OS a download is for as used on Google Code. |
| 145 """ | 152 """ |
| 146 os_str = 'win' | 153 os_str = 'win' |
| 147 if 'darwin' in sys.platform: | 154 if 'darwin' in sys.platform: |
| 148 os_str = 'mac' | 155 os_str = 'mac' |
| 149 elif 'linux' in sys.platform: | 156 elif 'linux' in sys.platform: |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 lambda x: 'chromedriver_%(os)s_%(version)s.zip' % x).run() | 252 lambda x: 'chromedriver_%(os)s_%(version)s.zip' % x).run() |
| 246 if 'win32' not in sys.platform and 'cygwin' not in sys.platform: | 253 if 'win32' not in sys.platform and 'cygwin' not in sys.platform: |
| 247 GoogleCodeInstaller('selenium', os.path.dirname(os.path.abspath(__file__)), | 254 GoogleCodeInstaller('selenium', os.path.dirname(os.path.abspath(__file__)), |
| 248 lambda x: 'selenium-server-standalone-%(version)s.jar' % x).run() | 255 lambda x: 'selenium-server-standalone-%(version)s.jar' % x).run() |
| 249 | 256 |
| 250 if args.firefox: | 257 if args.firefox: |
| 251 FirefoxInstaller().run() | 258 FirefoxInstaller().run() |
| 252 | 259 |
| 253 if __name__ == '__main__': | 260 if __name__ == '__main__': |
| 254 main() | 261 main() |
| OLD | NEW |