Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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: | |
| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 |
| 134 if CheckX86Image(): | 138 if CheckX86Image(): |
| 135 logging.info('system-images directory already exists.') | 139 logging.info('system-images directory already exists.') |
| 136 else: | 140 else: |
| 137 GetX86Image() | 141 GetX86Image() |
| 138 | 142 |
| 143 logging.info('Emulator deps for ARM emulator complete.') | |
|
pasko-google - do not use
2013/04/05 09:41:05
s/ARM/X86/
navabi
2013/04/08 21:41:56
This log statement is to indicate the deps are rea
pasko-google - do not use
2013/04/09 08:41:45
Oh yes, thanks. The confusing part was exactly thi
| |
| 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)) |
| OLD | NEW |