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

Side by Side Diff: chrome/test/pyautolib/fetch_prebuilt_pyauto.py

Issue 8898029: Fix pyauto's fetch_prebuilt_pyauto.py to account for URL changes on official build site. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Fetch prebuilt binaries to run PyAuto. 6 """Fetch prebuilt binaries to run PyAuto.
7 7
8 Sets up Chrome and PyAuto binaries using prebuilt binaries from the 8 Sets up Chrome and PyAuto binaries using prebuilt binaries from the
9 continuous build archives. Works on mac, win, linux (32 & 64 bit). 9 continuous build archives. Works on mac, win, linux (32 & 64 bit).
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 pyauto_utils.GetCurrentPlatform()) 47 pyauto_utils.GetCurrentPlatform())
48 self._options, self._args = parser.parse_args() 48 self._options, self._args = parser.parse_args()
49 if not self._options.outdir: 49 if not self._options.outdir:
50 print >>sys.stderr, 'Need output directory: -d/--outdir' 50 print >>sys.stderr, 'Need output directory: -d/--outdir'
51 sys.exit(1) 51 sys.exit(1)
52 if not self._args: 52 if not self._args:
53 print >>sys.stderr, 'Need download url' 53 print >>sys.stderr, 'Need download url'
54 sys.exit(2) 54 sys.exit(2)
55 self._outdir = self._options.outdir 55 self._outdir = self._options.outdir
56 self._url = self._args[0] 56 self._url = self._args[0]
57 if 'index.html?path=' in self._url:
Nirnimesh 2011/12/13 22:15:09 Add a comment: # Chromium continuous build archiv
dennis_jeffrey 2011/12/14 19:33:13 Done.
58 self._url = self._url.replace('index.html?path=', '')
59 if self._url.endswith('/'):
Nirnimesh 2011/12/13 22:15:09 self._url = self._url.rstrip('/')
dennis_jeffrey 2011/12/14 19:33:13 Nice.
60 self._url = self._url[:-1]
57 61
58 # Determine name of zip. 62 # Determine name of zip.
59 if not self._options.platform.startswith('linux'): 63 if not self._options.platform.startswith('linux'):
60 self._chrome_zip_name = 'chrome-%s' % { 'mac': 'mac', 64 self._chrome_zip_name = 'chrome-%s' % { 'mac': 'mac',
61 'win': 'win32' 65 'win': 'win32'
62 }[self._options.platform] 66 }[self._options.platform]
63 else: 67 else:
64 linux_32_names = ['linux', 'lucid32bit'] 68 linux_32_names = ['linux', 'lucid32bit']
65 linux_64_names = ['linux64', 'lucid64bit'] 69 linux_64_names = ['linux64', 'lucid64bit']
66 linux_names = { 'linux': linux_32_names + linux_64_names, 70 linux_names = { 'linux': linux_32_names + linux_64_names,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 """Remove old binaries, if any.""" 107 """Remove old binaries, if any."""
104 pass 108 pass
105 109
106 def Run(self): 110 def Run(self):
107 self._ParseArgs() 111 self._ParseArgs()
108 if not os.path.isdir(self._outdir): 112 if not os.path.isdir(self._outdir):
109 os.makedirs(self._outdir) 113 os.makedirs(self._outdir)
110 get_it2me = self._DoesURLExist(self._it2me_zip_url) 114 get_it2me = self._DoesURLExist(self._it2me_zip_url)
111 115
112 # Fetch chrome & pyauto binaries 116 # Fetch chrome & pyauto binaries
113 print 'Fetching' 117 print 'Fetching ' + self._chrome_zip_url
114 print self._chrome_zip_url 118 chrome_zip = urllib.urlretrieve(self._chrome_zip_url)[0]
119
115 if get_it2me: 120 if get_it2me:
116 print self._it2me_zip_url 121 print 'Fetching ' + self._it2me_zip_url
122 it2me_zip = urllib.urlretrieve(self._it2me_zip_url)[0]
117 else: 123 else:
118 print 'Warning: %s does not exist.' % self._it2me_zip_url 124 print 'Warning: %s does not exist.' % self._it2me_zip_url
119 print self._pyautolib_py_url 125
120 print self._pyautolib_so_url 126 print 'Fetching ' + self._pyautolib_py_url
121 print self._chromedriver_url
122 chrome_zip = urllib.urlretrieve(self._chrome_zip_url)[0]
123 if get_it2me:
124 it2me_zip = urllib.urlretrieve(self._it2me_zip_url)[0]
125 pyautolib_py = urllib.urlretrieve(self._pyautolib_py_url)[0] 127 pyautolib_py = urllib.urlretrieve(self._pyautolib_py_url)[0]
128
129 print 'Fetching ' + self._pyautolib_so_url
126 pyautolib_so = urllib.urlretrieve(self._pyautolib_so_url)[0] 130 pyautolib_so = urllib.urlretrieve(self._pyautolib_so_url)[0]
131
132 print 'Fetching ' + self._chromedriver_url
127 chromedriver = urllib.urlretrieve(self._chromedriver_url)[0] 133 chromedriver = urllib.urlretrieve(self._chromedriver_url)[0]
134
128 chrome_unzip_dir = os.path.join(self._outdir, self._chrome_zip_name) 135 chrome_unzip_dir = os.path.join(self._outdir, self._chrome_zip_name)
129 if os.path.exists(chrome_unzip_dir): 136 if os.path.exists(chrome_unzip_dir):
130 print 'Cleaning', chrome_unzip_dir 137 print 'Cleaning ' + chrome_unzip_dir
Nirnimesh 2011/12/13 22:15:09 it's pretty standard to use , with print
dennis_jeffrey 2011/12/14 19:33:13 Changed.
131 pyauto_utils.RemovePath(chrome_unzip_dir) 138 pyauto_utils.RemovePath(chrome_unzip_dir)
139 print 'Unzipping'
132 pyauto_utils.UnzipFilenameToDir(chrome_zip, self._outdir) 140 pyauto_utils.UnzipFilenameToDir(chrome_zip, self._outdir)
133 if get_it2me: 141 if get_it2me:
134 pyauto_utils.UnzipFilenameToDir(it2me_zip, self._outdir) 142 pyauto_utils.UnzipFilenameToDir(it2me_zip, self._outdir)
135 shutil.move(self._outdir + '/remoting-it2me', 143 shutil.move(self._outdir + '/remoting-it2me',
136 self._outdir + '/remoting/it2me.webapp') 144 self._outdir + '/remoting/it2me.webapp')
137 145
138 # Copy over the binaries to outdir 146 # Copy over the binaries to outdir
139 items_to_copy = { 147 items_to_copy = {
140 pyautolib_py: os.path.join(self._outdir, 'pyautolib.py'), 148 pyautolib_py: os.path.join(self._outdir, 'pyautolib.py'),
141 pyautolib_so: os.path.join(self._outdir, self._pyautolib_so_name), 149 pyautolib_so: os.path.join(self._outdir, self._pyautolib_so_name),
(...skipping 27 matching lines...) Expand all
169 os.path.lexists(dest) and os.remove(dest) 177 os.path.lexists(dest) and os.remove(dest)
170 print 'Creating symlink "%s"' % dest 178 print 'Creating symlink "%s"' % dest
171 os.symlink(framework, dest) 179 os.symlink(framework, dest)
172 180
173 print 'Prepared binaries in "%s"' % self._outdir 181 print 'Prepared binaries in "%s"' % self._outdir
174 return 0 182 return 0
175 183
176 184
177 if __name__ == '__main__': 185 if __name__ == '__main__':
178 sys.exit(FetchPrebuilt().Run()) 186 sys.exit(FetchPrebuilt().Run())
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