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

Side by Side Diff: build/android/install_emulator_deps.py

Issue 1315743004: [Android] Add a custom pylintrc for build/android/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix appurify_sanitized import-errors Created 5 years, 3 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
« no previous file with comments | « build/android/incremental_install.py ('k') | build/android/lighttpd_server.py » ('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) 2013 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2013 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 """Installs deps for using SDK emulator for testing. 6 """Installs deps for using SDK emulator for testing.
7 7
8 The script will download the SDK and system images, if they are not present, and 8 The script will download the SDK and system images, if they are not present, and
9 install and enable KVM, if virtualization has been enabled in the BIOS. 9 install and enable KVM, if virtualization has been enabled in the BIOS.
10 """ 10 """
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 raise Exception('ERROR: no URL known for x86 image for android-%s' % 173 raise Exception('ERROR: no URL known for x86 image for android-%s' %
174 api_level) 174 api_level)
175 try: 175 try:
176 cmd_helper.RunCmd(['curl', '-o', temp_file, X86_IMG_URLS[api_level]]) 176 cmd_helper.RunCmd(['curl', '-o', temp_file, X86_IMG_URLS[api_level]])
177 rc = cmd_helper.RunCmd(['unzip', '-o', temp_file, '-d', '/tmp/']) 177 rc = cmd_helper.RunCmd(['unzip', '-o', temp_file, '-d', '/tmp/'])
178 if rc: 178 if rc:
179 raise Exception('ERROR: Could not download/unzip image zip.') 179 raise Exception('ERROR: Could not download/unzip image zip.')
180 api_target = 'android-%d' % api_level 180 api_target = 'android-%d' % api_level
181 sys_imgs = os.path.join(constants.EMULATOR_SDK_ROOT, 'sdk', 181 sys_imgs = os.path.join(constants.EMULATOR_SDK_ROOT, 'sdk',
182 'system-images', api_target, 'x86') 182 'system-images', api_target, 'x86')
183 logging.info('Deploying system image to %s' % sys_imgs) 183 logging.info('Deploying system image to %s', sys_imgs)
184 shutil.move('/tmp/x86', sys_imgs) 184 shutil.move('/tmp/x86', sys_imgs)
185 finally: 185 finally:
186 os.unlink(temp_file) 186 os.unlink(temp_file)
187 187
188 188
189 def GetSDKPlatform(api_level=DEFAULT_ANDROID_API_LEVEL): 189 def GetSDKPlatform(api_level=DEFAULT_ANDROID_API_LEVEL):
190 """Update the SDK to include the platform specified. 190 """Update the SDK to include the platform specified.
191 191
192 Args: 192 Args:
193 api_level: the Android API level to download 193 api_level: the Android API level to download
(...skipping 10 matching lines...) Expand all
204 raise Exception('\'android list sdk\' command return %d' % exit_code) 204 raise Exception('\'android list sdk\' command return %d' % exit_code)
205 for line in stdout.split('\n'): 205 for line in stdout.split('\n'):
206 match = pattern.match(line) 206 match = pattern.match(line)
207 if match: 207 if match:
208 index = match.group(1) 208 index = match.group(1)
209 print 'package %s corresponds to platform level %d' % (index, api_level) 209 print 'package %s corresponds to platform level %d' % (index, api_level)
210 # update sdk --no-ui --filter $INDEX 210 # update sdk --no-ui --filter $INDEX
211 update_command = [android_binary, 211 update_command = [android_binary,
212 'update', 'sdk', '--no-ui', '--filter', index] 212 'update', 'sdk', '--no-ui', '--filter', index]
213 update_command_str = ' '.join(update_command) 213 update_command_str = ' '.join(update_command)
214 logging.info('running update command: %s' % update_command_str) 214 logging.info('running update command: %s', update_command_str)
215 update_process = pexpect.spawn(update_command_str) 215 update_process = pexpect.spawn(update_command_str)
216 # TODO(andrewhayden): Do we need to bug the user about this? 216 # TODO(andrewhayden): Do we need to bug the user about this?
217 if update_process.expect('Do you accept the license') != 0: 217 if update_process.expect('Do you accept the license') != 0:
218 raise Exception('License agreement check failed') 218 raise Exception('License agreement check failed')
219 update_process.sendline('y') 219 update_process.sendline('y')
220 if update_process.expect('Done. 1 package installed.') == 0: 220 if update_process.expect('Done. 1 package installed.') == 0:
221 print 'Successfully installed platform for API level %d' % api_level 221 print 'Successfully installed platform for API level %d' % api_level
222 return 222 return
223 else: 223 else:
224 raise Exception('Failed to install platform update') 224 raise Exception('Failed to install platform update')
(...skipping 20 matching lines...) Expand all
245 run_tests_helper.SetLogLevel(verbose_count=verbosity) 245 run_tests_helper.SetLogLevel(verbose_count=verbosity)
246 246
247 # Calls below will download emulator SDK and/or system images only if needed. 247 # Calls below will download emulator SDK and/or system images only if needed.
248 if CheckSDK(): 248 if CheckSDK():
249 logging.info('android_emulator_sdk/ already exists, skipping download.') 249 logging.info('android_emulator_sdk/ already exists, skipping download.')
250 else: 250 else:
251 GetSDK() 251 GetSDK()
252 252
253 # Check target. The target has to be installed in order to run the emulator. 253 # Check target. The target has to be installed in order to run the emulator.
254 if CheckSDKPlatform(options.api_level): 254 if CheckSDKPlatform(options.api_level):
255 logging.info('SDK platform android-%d already present, skipping.' % 255 logging.info('SDK platform android-%d already present, skipping.',
256 options.api_level) 256 options.api_level)
257 else: 257 else:
258 logging.info('SDK platform android-%d not present, installing.' % 258 logging.info('SDK platform android-%d not present, installing.',
259 options.api_level) 259 options.api_level)
260 GetSDKPlatform(options.api_level) 260 GetSDKPlatform(options.api_level)
261 261
262 # Download the x86 system image only if needed. 262 # Download the x86 system image only if needed.
263 if CheckX86Image(options.api_level): 263 if CheckX86Image(options.api_level):
264 logging.info('x86 image for android-%d already present, skipping.' % 264 logging.info('x86 image for android-%d already present, skipping.',
265 options.api_level) 265 options.api_level)
266 else: 266 else:
267 GetX86Image(options.api_level) 267 GetX86Image(options.api_level)
268 268
269 # Make sure KVM packages are installed and enabled. 269 # Make sure KVM packages are installed and enabled.
270 if CheckKVM(): 270 if CheckKVM():
271 logging.info('KVM already installed and enabled.') 271 logging.info('KVM already installed and enabled.')
272 else: 272 else:
273 InstallKVM() 273 InstallKVM()
274 274
275 275
276 if __name__ == '__main__': 276 if __name__ == '__main__':
277 sys.exit(main(sys.argv)) 277 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « build/android/incremental_install.py ('k') | build/android/lighttpd_server.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698