| 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 platform |
| 9 import sys | 10 import sys |
| 10 import tempfile | 11 import tempfile |
| 11 import threading | 12 import threading |
| 12 | 13 |
| 13 # TODO(jbudorick): Update this once dependency_manager moves to catapult. | 14 # TODO(jbudorick): Update this once dependency_manager moves to catapult. |
| 14 CATAPULT_BASE_PATH = os.path.abspath(os.path.join( | 15 CATAPULT_BASE_PATH = os.path.abspath(os.path.join( |
| 15 os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, | 16 os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, |
| 16 'tools', 'telemetry')) | 17 'tools', 'telemetry')) |
| 17 | 18 |
| 18 @contextlib.contextmanager | 19 @contextlib.contextmanager |
| (...skipping 11 matching lines...) Expand all Loading... |
| 30 from catapult_base import dependency_manager # pylint: disable=import-error | 31 from catapult_base import dependency_manager # pylint: disable=import-error |
| 31 | 32 |
| 32 _ANDROID_BUILD_TOOLS = {'aapt', 'dexdump', 'split-select'} | 33 _ANDROID_BUILD_TOOLS = {'aapt', 'dexdump', 'split-select'} |
| 33 | 34 |
| 34 _DEVIL_DEFAULT_CONFIG = os.path.abspath(os.path.join( | 35 _DEVIL_DEFAULT_CONFIG = os.path.abspath(os.path.join( |
| 35 os.path.dirname(__file__), 'devil_dependencies.json')) | 36 os.path.dirname(__file__), 'devil_dependencies.json')) |
| 36 | 37 |
| 37 _LEGACY_ENVIRONMENT_VARIABLES = { | 38 _LEGACY_ENVIRONMENT_VARIABLES = { |
| 38 'ADB_PATH': { | 39 'ADB_PATH': { |
| 39 'dependency_name': 'adb', | 40 'dependency_name': 'adb', |
| 40 'platform': 'android_linux2', | 41 'platform': 'linux_x86_64', |
| 41 }, | 42 }, |
| 42 'ANDROID_SDK_ROOT': { | 43 'ANDROID_SDK_ROOT': { |
| 43 'dependency_name': 'android_sdk', | 44 'dependency_name': 'android_sdk', |
| 44 'platform': 'android_linux2', | 45 'platform': 'linux_x86_64', |
| 45 }, | 46 }, |
| 46 } | 47 } |
| 47 | 48 |
| 48 | 49 |
| 49 def _GetEnvironmentVariableConfig(): | 50 def _GetEnvironmentVariableConfig(): |
| 50 path_config = ( | 51 path_config = ( |
| 51 (os.environ.get(k), v) | 52 (os.environ.get(k), v) |
| 52 for k, v in _LEGACY_ENVIRONMENT_VARIABLES.iteritems()) | 53 for k, v in _LEGACY_ENVIRONMENT_VARIABLES.iteritems()) |
| 53 return { | 54 return { |
| 54 'config_type': 'BaseConfig', | 55 'config_type': 'BaseConfig', |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 self.FetchPath('android_build_tools_libc++', arch=arch, device=device) | 130 self.FetchPath('android_build_tools_libc++', arch=arch, device=device) |
| 130 return self._dm.FetchPath(dependency, GetPlatform(arch, device)) | 131 return self._dm.FetchPath(dependency, GetPlatform(arch, device)) |
| 131 | 132 |
| 132 def LocalPath(self, dependency, arch=None, device=None): | 133 def LocalPath(self, dependency, arch=None, device=None): |
| 133 if self._dm is None: | 134 if self._dm is None: |
| 134 self.Initialize() | 135 self.Initialize() |
| 135 return self._dm.LocalPath(dependency, GetPlatform(arch, device)) | 136 return self._dm.LocalPath(dependency, GetPlatform(arch, device)) |
| 136 | 137 |
| 137 | 138 |
| 138 def GetPlatform(arch=None, device=None): | 139 def GetPlatform(arch=None, device=None): |
| 139 if not arch: | 140 if device: |
| 140 arch = device.product_cpu_abi if device else sys.platform | 141 return 'android_%s' % (arch or device.product_cpu_abi) |
| 141 return 'android_%s' % arch | 142 return 'linux_%s' % platform.machine() |
| 142 | 143 |
| 143 | 144 |
| 144 config = _Environment() | 145 config = _Environment() |
| 145 | 146 |
| OLD | NEW |