OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import contextlib | 5 import contextlib |
6 import json | 6 import json |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import sys | 9 import sys |
10 import tempfile | 10 import tempfile |
(...skipping 19 matching lines...) Expand all Loading... |
30 from catapult_base import dependency_manager # pylint: disable=import-error | 30 from catapult_base import dependency_manager # pylint: disable=import-error |
31 | 31 |
32 _ANDROID_BUILD_TOOLS = {'aapt', 'dexdump', 'split-select'} | 32 _ANDROID_BUILD_TOOLS = {'aapt', 'dexdump', 'split-select'} |
33 | 33 |
34 _DEVIL_DEFAULT_CONFIG = os.path.abspath(os.path.join( | 34 _DEVIL_DEFAULT_CONFIG = os.path.abspath(os.path.join( |
35 os.path.dirname(__file__), 'devil_dependencies.json')) | 35 os.path.dirname(__file__), 'devil_dependencies.json')) |
36 | 36 |
37 _LEGACY_ENVIRONMENT_VARIABLES = { | 37 _LEGACY_ENVIRONMENT_VARIABLES = { |
38 'ADB_PATH': { | 38 'ADB_PATH': { |
39 'dependency_name': 'adb', | 39 'dependency_name': 'adb', |
40 'platform': 'android_host', | 40 'platform': 'android_linux2', |
41 }, | 41 }, |
42 'ANDROID_SDK_ROOT': { | 42 'ANDROID_SDK_ROOT': { |
43 'dependency_name': 'android_sdk', | 43 'dependency_name': 'android_sdk', |
44 'platform': 'android_host', | 44 'platform': 'android_linux2', |
45 }, | 45 }, |
46 } | 46 } |
47 | 47 |
48 | 48 |
49 def _GetEnvironmentVariableConfig(): | 49 def _GetEnvironmentVariableConfig(): |
50 env_var_config = {} | 50 env_var_config = {} |
51 for k, v in _LEGACY_ENVIRONMENT_VARIABLES.iteritems(): | 51 for k, v in _LEGACY_ENVIRONMENT_VARIABLES.iteritems(): |
52 path = os.environ.get(k) | 52 path = os.environ.get(k) |
53 if path: | 53 if path: |
54 env_var_config[v['dependency_name']] = { | 54 env_var_config[v['dependency_name']] = { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 config_files.append(_DEVIL_DEFAULT_CONFIG) | 113 config_files.append(_DEVIL_DEFAULT_CONFIG) |
114 | 114 |
115 self._dm = dependency_manager.DependencyManager( | 115 self._dm = dependency_manager.DependencyManager( |
116 [dependency_manager.BaseConfig(c) for c in config_files]) | 116 [dependency_manager.BaseConfig(c) for c in config_files]) |
117 | 117 |
118 def FetchPath(self, dependency, arch=None, device=None): | 118 def FetchPath(self, dependency, arch=None, device=None): |
119 if self._dm is None: | 119 if self._dm is None: |
120 self.Initialize() | 120 self.Initialize() |
121 if dependency in _ANDROID_BUILD_TOOLS: | 121 if dependency in _ANDROID_BUILD_TOOLS: |
122 self.FetchPath('android_build_tools_libc++', arch=arch, device=device) | 122 self.FetchPath('android_build_tools_libc++', arch=arch, device=device) |
123 return self._dm.FetchPath(dependency, _GetPlatform(arch, device)) | 123 return self._dm.FetchPath(dependency, GetPlatform(arch, device)) |
124 | 124 |
125 def LocalPath(self, dependency, arch=None, device=None): | 125 def LocalPath(self, dependency, arch=None, device=None): |
126 if self._dm is None: | 126 if self._dm is None: |
127 self.Initialize() | 127 self.Initialize() |
128 return self._dm.LocalPath(dependency, _GetPlatform(arch, device)) | 128 return self._dm.LocalPath(dependency, GetPlatform(arch, device)) |
129 | 129 |
130 | 130 |
131 def _GetPlatform(arch, device): | 131 def GetPlatform(arch=None, device=None): |
132 if not arch: | 132 if not arch: |
133 arch = device.product_cpu_abi if device else 'host' | 133 arch = device.product_cpu_abi if device else sys.platform |
134 return 'android_%s' % arch | 134 return 'android_%s' % arch |
135 | 135 |
136 | 136 |
137 config = _Environment() | 137 config = _Environment() |
138 | 138 |
OLD | NEW |