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

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

Issue 13543008: Fix AVD configuration and defaults based on dogfooder input. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed misleading comment. Created 7 years, 8 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
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 'android_tools', 'sdk', 'system-images', 52 'android_tools', 'sdk', 'system-images',
53 API_TARGET, 'x86')) 53 API_TARGET, 'x86'))
54 54
55 55
56 def CheckKVM(): 56 def CheckKVM():
57 """Check if KVM is enabled. 57 """Check if KVM is enabled.
58 58
59 Returns: 59 Returns:
60 True if kvm-ok returns 0 (already enabled) 60 True if kvm-ok returns 0 (already enabled)
61 """ 61 """
62 rc = cmd_helper.RunCmd(['kvm-ok']) 62 try:
63 rc = cmd_helper.RunCmd(['kvm-ok'])
64 except Exception, e:
frankf 2013/04/09 17:16:48 please avoid using general exceptions.
navabi 2013/04/09 21:53:55 Done. Rebased with this committed CL as part of fi
65 logging.info('kvm-ok not installed')
66 return False
63 return not rc 67 return not rc
64 68
65 69
66 def GetSDK(): 70 def GetSDK():
67 """Download the SDK and unzip in android_tools directory.""" 71 """Download the SDK and unzip in android_tools directory."""
68 logging.info('Download Android SDK.') 72 logging.info('Download Android SDK.')
69 sdk_url = '%s/%s' % (SDK_BASE_URL, SDK_ZIP) 73 sdk_url = '%s/%s' % (SDK_BASE_URL, SDK_ZIP)
70 try: 74 try:
71 cmd_helper.RunCmd(['curl', '-o', '/tmp/sdk.zip', sdk_url]) 75 cmd_helper.RunCmd(['curl', '-o', '/tmp/sdk.zip', sdk_url])
72 print 'curled unzipping...' 76 print 'curled unzipping...'
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 logging.basicConfig(level=logging.INFO, 128 logging.basicConfig(level=logging.INFO,
125 format='# %(asctime)-15s: %(message)s') 129 format='# %(asctime)-15s: %(message)s')
126 run_tests_helper.SetLogLevel(verbose_count=1) 130 run_tests_helper.SetLogLevel(verbose_count=1)
127 131
128 # Calls below will download emulator SDK and/or system images only if needed. 132 # Calls below will download emulator SDK and/or system images only if needed.
129 if CheckSDK(): 133 if CheckSDK():
130 logging.info('android_tools directory already exists (not downloading).') 134 logging.info('android_tools directory already exists (not downloading).')
131 else: 135 else:
132 GetSDK() 136 GetSDK()
133 137
138 logging.info('Emulator deps for ARM emulator complete.')
139
134 if CheckX86Image(): 140 if CheckX86Image():
135 logging.info('system-images directory already exists.') 141 logging.info('system-images directory already exists.')
136 else: 142 else:
137 GetX86Image() 143 GetX86Image()
138 144
139 # Make sure KVM packages are installed and enabled. 145 # Make sure KVM packages are installed and enabled.
140 if CheckKVM(): 146 if CheckKVM():
141 logging.info('KVM already installed and enabled.') 147 logging.info('KVM already installed and enabled.')
142 else: 148 else:
143 InstallKVM() 149 InstallKVM()
144 150
145 151
146 if __name__ == '__main__': 152 if __name__ == '__main__':
147 sys.exit(main(sys.argv)) 153 sys.exit(main(sys.argv))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698