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_linux2', | 40 'platform': 'android_linux2', |
jbudorick
2015/12/08 03:48:17
android_linux2 comes from here.
| |
41 }, | 41 }, |
42 'ANDROID_SDK_ROOT': { | 42 'ANDROID_SDK_ROOT': { |
43 'dependency_name': 'android_sdk', | 43 'dependency_name': 'android_sdk', |
44 'platform': 'android_linux2', | 44 'platform': 'android_linux2', |
45 }, | 45 }, |
46 } | 46 } |
47 | 47 |
48 | 48 |
49 def _GetEnvironmentVariableConfig(): | 49 def _GetEnvironmentVariableConfig(): |
50 env_var_config = {} | 50 path_config = ( |
51 for k, v in _LEGACY_ENVIRONMENT_VARIABLES.iteritems(): | 51 (os.environ.get(k), v) |
52 path = os.environ.get(k) | 52 for k, v in _LEGACY_ENVIRONMENT_VARIABLES.iteritems()) |
53 if path: | 53 return { |
54 env_var_config[v['dependency_name']] = { | 54 'config_type': 'BaseConfig', |
55 'dependencies': { | |
56 c['dependency_name']: { | |
55 'file_info': { | 57 'file_info': { |
56 v['platform']: { | 58 c['platform']: { |
57 'local_paths': [path] | 59 'local_paths': [p], |
58 } | 60 }, |
59 } | 61 }, |
60 } | 62 } for p, c in path_config if p |
61 return env_var_config | 63 }, |
64 } | |
62 | 65 |
mikecase (-- gone --)
2015/12/08 03:44:27
This change just adds the 'config_type': 'BaseConf
jbudorick
2015/12/08 03:48:17
this change both adds 'config_type' and moves the
mikecase (-- gone --)
2015/12/08 04:27:22
oops, typo in my first comment, I meant to say I a
| |
63 | 66 |
64 class _Environment(object): | 67 class _Environment(object): |
65 | 68 |
66 def __init__(self): | 69 def __init__(self): |
67 self._dm_init_lock = threading.Lock() | 70 self._dm_init_lock = threading.Lock() |
68 self._dm = None | 71 self._dm = None |
69 | 72 |
70 def Initialize(self, configs=None, config_files=None): | 73 def Initialize(self, configs=None, config_files=None): |
71 """Initialize devil's environment from configuration files. | 74 """Initialize devil's environment from configuration files. |
72 | 75 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 | 132 |
130 | 133 |
131 def GetPlatform(arch=None, device=None): | 134 def GetPlatform(arch=None, device=None): |
132 if not arch: | 135 if not arch: |
133 arch = device.product_cpu_abi if device else sys.platform | 136 arch = device.product_cpu_abi if device else sys.platform |
134 return 'android_%s' % arch | 137 return 'android_%s' % arch |
135 | 138 |
136 | 139 |
137 config = _Environment() | 140 config = _Environment() |
138 | 141 |
OLD | NEW |