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

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

Issue 9187039: Remove more references to the deprecated webapp_it2me. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 8 years, 11 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 | « build/all.gyp ('k') | chrome/tools/build/linux/FILES.cfg » ('j') | 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 for name in linux_names: 74 for name in linux_names:
75 zip_name = 'chrome-' + name 75 zip_name = 'chrome-' + name
76 if self._DoesURLExist('%s/%s.zip' % (self._url, zip_name)): 76 if self._DoesURLExist('%s/%s.zip' % (self._url, zip_name)):
77 self._chrome_zip_name = zip_name 77 self._chrome_zip_name = zip_name
78 break 78 break
79 else: 79 else:
80 raise RuntimeError('Could not find chrome zip at ' + self._url) 80 raise RuntimeError('Could not find chrome zip at ' + self._url)
81 81
82 # Setup urls to download. 82 # Setup urls to download.
83 self._chrome_zip_url = '%s/%s.zip' % (self._url, self._chrome_zip_name) 83 self._chrome_zip_url = '%s/%s.zip' % (self._url, self._chrome_zip_name)
84 self._it2me_zip_url = self._url + '/' + 'remoting-it2me.zip' 84 self._remoting_zip_url = self._url + '/' + 'remoting-webapp.zip'
85 chrome_test_url = '%s/%s.test' % (self._url, self._chrome_zip_name) 85 chrome_test_url = '%s/%s.test' % (self._url, self._chrome_zip_name)
86 self._pyautolib_py_url = '%s/pyautolib.py' % chrome_test_url 86 self._pyautolib_py_url = '%s/pyautolib.py' % chrome_test_url
87 if self._options.platform == 'win': 87 if self._options.platform == 'win':
88 self._pyautolib_so_name = '_pyautolib.pyd' 88 self._pyautolib_so_name = '_pyautolib.pyd'
89 self._chromedriver_name = 'chromedriver.exe' 89 self._chromedriver_name = 'chromedriver.exe'
90 else: 90 else:
91 self._pyautolib_so_name = '_pyautolib.so' 91 self._pyautolib_so_name = '_pyautolib.so'
92 self._chromedriver_name = 'chromedriver' 92 self._chromedriver_name = 'chromedriver'
93 self._pyautolib_so_url = chrome_test_url + '/' + self._pyautolib_so_name 93 self._pyautolib_so_url = chrome_test_url + '/' + self._pyautolib_so_name
94 self._chromedriver_url = chrome_test_url + '/' + self._chromedriver_name 94 self._chromedriver_url = chrome_test_url + '/' + self._chromedriver_name
95 95
96 def _DoesURLExist(self, url): 96 def _DoesURLExist(self, url):
97 """Determines whether a resource exists at the given URL.""" 97 """Determines whether a resource exists at the given URL."""
98 parsed = urlparse.urlparse(url) 98 parsed = urlparse.urlparse(url)
99 conn = httplib.HTTPConnection(parsed.netloc) 99 conn = httplib.HTTPConnection(parsed.netloc)
100 conn.request('HEAD', parsed.path) 100 conn.request('HEAD', parsed.path)
101 response = conn.getresponse() 101 response = conn.getresponse()
102 if response.status == 302: # Redirect; follow it. 102 if response.status == 302: # Redirect; follow it.
103 return self._DoesURLExist(response.getheader('location')) 103 return self._DoesURLExist(response.getheader('location'))
104 return response.status == 200 104 return response.status == 200
105 105
106 def Cleanup(self): 106 def Cleanup(self):
107 """Remove old binaries, if any.""" 107 """Remove old binaries, if any."""
108 pass 108 pass
109 109
110 def Run(self): 110 def Run(self):
111 self._ParseArgs() 111 self._ParseArgs()
112 if not os.path.isdir(self._outdir): 112 if not os.path.isdir(self._outdir):
113 os.makedirs(self._outdir) 113 os.makedirs(self._outdir)
114 get_it2me = self._DoesURLExist(self._it2me_zip_url) 114 get_remoting = self._DoesURLExist(self._remoting_zip_url)
115 115
116 # Fetch chrome & pyauto binaries 116 # Fetch chrome & pyauto binaries
117 print 'Fetching', self._chrome_zip_url 117 print 'Fetching', self._chrome_zip_url
118 chrome_zip = urllib.urlretrieve(self._chrome_zip_url)[0] 118 chrome_zip = urllib.urlretrieve(self._chrome_zip_url)[0]
119 119
120 if get_it2me: 120 if get_remoting:
121 print 'Fetching', self._it2me_zip_url 121 print 'Fetching', self._remoting_zip_url
122 it2me_zip = urllib.urlretrieve(self._it2me_zip_url)[0] 122 remoting_zip = urllib.urlretrieve(self._remoting_zip_url)[0]
123 else: 123 else:
124 print 'Warning: %s does not exist.' % self._it2me_zip_url 124 print 'Warning: %s does not exist.' % self._remoting_zip_url
125 125
126 print 'Fetching', self._pyautolib_py_url 126 print 'Fetching', self._pyautolib_py_url
127 pyautolib_py = urllib.urlretrieve(self._pyautolib_py_url)[0] 127 pyautolib_py = urllib.urlretrieve(self._pyautolib_py_url)[0]
128 128
129 print 'Fetching', self._pyautolib_so_url 129 print 'Fetching', self._pyautolib_so_url
130 pyautolib_so = urllib.urlretrieve(self._pyautolib_so_url)[0] 130 pyautolib_so = urllib.urlretrieve(self._pyautolib_so_url)[0]
131 131
132 print 'Fetching', self._chromedriver_url 132 print 'Fetching', self._chromedriver_url
133 chromedriver = urllib.urlretrieve(self._chromedriver_url)[0] 133 chromedriver = urllib.urlretrieve(self._chromedriver_url)[0]
134 134
135 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)
136 if os.path.exists(chrome_unzip_dir): 136 if os.path.exists(chrome_unzip_dir):
137 print 'Cleaning', chrome_unzip_dir 137 print 'Cleaning', chrome_unzip_dir
138 pyauto_utils.RemovePath(chrome_unzip_dir) 138 pyauto_utils.RemovePath(chrome_unzip_dir)
139 print 'Unzipping' 139 print 'Unzipping'
140 pyauto_utils.UnzipFilenameToDir(chrome_zip, self._outdir) 140 pyauto_utils.UnzipFilenameToDir(chrome_zip, self._outdir)
141 if get_it2me: 141 if get_remoting:
142 pyauto_utils.UnzipFilenameToDir(it2me_zip, self._outdir) 142 pyauto_utils.UnzipFilenameToDir(remoting_zip, self._outdir)
143 shutil.move(self._outdir + '/remoting-it2me', 143 shutil.move(self._outdir + '/remoting-webapp',
144 self._outdir + '/remoting/it2me.webapp') 144 self._outdir + '/remoting/remoting.webapp')
145 145
146 # Copy over the binaries to outdir 146 # Copy over the binaries to outdir
147 items_to_copy = { 147 items_to_copy = {
148 pyautolib_py: os.path.join(self._outdir, 'pyautolib.py'), 148 pyautolib_py: os.path.join(self._outdir, 'pyautolib.py'),
149 pyautolib_so: os.path.join(self._outdir, self._pyautolib_so_name), 149 pyautolib_so: os.path.join(self._outdir, self._pyautolib_so_name),
150 chromedriver: os.path.join(self._outdir, self._chromedriver_name) 150 chromedriver: os.path.join(self._outdir, self._chromedriver_name)
151 } 151 }
152 unzip_dir_contents = glob.glob(os.path.join(chrome_unzip_dir, '*')) 152 unzip_dir_contents = glob.glob(os.path.join(chrome_unzip_dir, '*'))
153 for item in unzip_dir_contents: 153 for item in unzip_dir_contents:
154 name = os.path.basename(item) 154 name = os.path.basename(item)
(...skipping 22 matching lines...) Expand all
177 os.path.lexists(dest) and os.remove(dest) 177 os.path.lexists(dest) and os.remove(dest)
178 print 'Creating symlink "%s"' % dest 178 print 'Creating symlink "%s"' % dest
179 os.symlink(framework, dest) 179 os.symlink(framework, dest)
180 180
181 print 'Prepared binaries in "%s"' % self._outdir 181 print 'Prepared binaries in "%s"' % self._outdir
182 return 0 182 return 0
183 183
184 184
185 if __name__ == '__main__': 185 if __name__ == '__main__':
186 sys.exit(FetchPrebuilt().Run()) 186 sys.exit(FetchPrebuilt().Run())
OLDNEW
« no previous file with comments | « build/all.gyp ('k') | chrome/tools/build/linux/FILES.cfg » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698