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

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

Issue 23513022: android: Point EMULATOR_SDK_ROOT to a location inside the repository. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch v3: get rid of EMULATOR_SDK_ROOT altogether Created 7 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 | Annotate | Revision Log
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 system images, if they are not present, and 8 The script will download 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 13 matching lines...) Expand all
24 X86_IMG_URL = 'http://download-software.intel.com/sites/landingpage/android/sysi mg_x86-17_r01.zip' 24 X86_IMG_URL = 'http://download-software.intel.com/sites/landingpage/android/sysi mg_x86-17_r01.zip'
25 25
26 # Android API level 26 # Android API level
27 API_TARGET = 'android-%s' % constants.ANDROID_SDK_VERSION 27 API_TARGET = 'android-%s' % constants.ANDROID_SDK_VERSION
28 28
29 29
30 def CheckSDK(): 30 def CheckSDK():
31 """Check if SDK is already installed. 31 """Check if SDK is already installed.
32 32
33 Returns: 33 Returns:
34 True if android_tools directory exists in current directory. 34 True if the third_party/android_tools/sdk directory exists.
35 """ 35 """
36 return os.path.exists(os.path.join(constants.EMULATOR_SDK_ROOT, 36 return os.path.exists(constants.ANDROID_SDK_ROOT)
37 'android_tools'))
38 37
39 38
40 def CheckX86Image(): 39 def CheckX86Image():
41 """Check if Android system images have been installed. 40 """Check if Android system images have been installed.
42 41
43 Returns: 42 Returns:
44 True if android_tools/sdk/system-images directory exists. 43 True if android_tools/sdk/system-images directory exists.
45 """ 44 """
46 return os.path.exists(os.path.join(constants.EMULATOR_SDK_ROOT, 45 return os.path.exists(os.path.join(constants.ANDROID_SDK_ROOT,
47 'android_tools', 'sdk', 'system-images', 46 'system-images', API_TARGET, 'x86'))
Peter Beverloo 2013/09/11 17:29:35 The comment doesn't match the code.
48 API_TARGET, 'x86'))
49 47
50 48
51 def CheckKVM(): 49 def CheckKVM():
52 """Check if KVM is enabled. 50 """Check if KVM is enabled.
53 51
54 Returns: 52 Returns:
55 True if kvm-ok returns 0 (already enabled) 53 True if kvm-ok returns 0 (already enabled)
56 """ 54 """
57 try: 55 try:
58 return not cmd_helper.RunCmd(['kvm-ok']) 56 return not cmd_helper.RunCmd(['kvm-ok'])
(...skipping 24 matching lines...) Expand all
83 81
84 def GetX86Image(): 82 def GetX86Image():
85 """Download x86 system image from Intel's website.""" 83 """Download x86 system image from Intel's website."""
86 logging.info('Download x86 system image directory into sdk directory.') 84 logging.info('Download x86 system image directory into sdk directory.')
87 try: 85 try:
88 cmd_helper.RunCmd(['curl', '-o', '/tmp/x86_img.zip', X86_IMG_URL]) 86 cmd_helper.RunCmd(['curl', '-o', '/tmp/x86_img.zip', X86_IMG_URL])
89 rc = cmd_helper.RunCmd(['unzip', '-o', '/tmp/x86_img.zip', '-d', '/tmp/']) 87 rc = cmd_helper.RunCmd(['unzip', '-o', '/tmp/x86_img.zip', '-d', '/tmp/'])
90 if rc: 88 if rc:
91 logging.critical('ERROR: Could not download/unzip image zip.') 89 logging.critical('ERROR: Could not download/unzip image zip.')
92 raise 90 raise
93 sys_imgs = os.path.join(constants.EMULATOR_SDK_ROOT, 'android_tools', 'sdk', 91 sys_imgs = os.path.join(constants.ANDROID_SDK_ROOT, 'system-images',
94 'system-images', API_TARGET, 'x86') 92 API_TARGET, 'x86')
95 shutil.move('/tmp/x86', sys_imgs) 93 shutil.move('/tmp/x86', sys_imgs)
96 finally: 94 finally:
97 os.unlink('/tmp/x86_img.zip') 95 os.unlink('/tmp/x86_img.zip')
98 96
99 97
100 def main(argv): 98 def main(argv):
101 logging.basicConfig(level=logging.INFO, 99 logging.basicConfig(level=logging.INFO,
102 format='# %(asctime)-15s: %(message)s') 100 format='# %(asctime)-15s: %(message)s')
103 run_tests_helper.SetLogLevel(verbose_count=1) 101 run_tests_helper.SetLogLevel(verbose_count=1)
104 102
(...skipping 15 matching lines...) Expand all
120 118
121 # Make sure KVM packages are installed and enabled. 119 # Make sure KVM packages are installed and enabled.
122 if CheckKVM(): 120 if CheckKVM():
123 logging.info('KVM already installed and enabled.') 121 logging.info('KVM already installed and enabled.')
124 else: 122 else:
125 InstallKVM() 123 InstallKVM()
126 124
127 125
128 if __name__ == '__main__': 126 if __name__ == '__main__':
129 sys.exit(main(sys.argv)) 127 sys.exit(main(sys.argv))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698