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

Unified Diff: devil/devil/devil_env.py

Issue 2267813002: [devil] Add device provisioning logic to devil. (Closed) Base URL: git@github.com:catapult-project/catapult.git@master
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « devil/devil/android/tools/script_common.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: devil/devil/devil_env.py
diff --git a/devil/devil/devil_env.py b/devil/devil/devil_env.py
index b54e6f5bdacc7205d1d025d5dad8dc53778d5ba6..457fd92a6743c6a3d1149b40014669b84c16e665 100644
--- a/devil/devil/devil_env.py
+++ b/devil/devil/devil_env.py
@@ -47,24 +47,39 @@ _LEGACY_ENVIRONMENT_VARIABLES = {
}
-def _GetEnvironmentVariableConfig():
- path_config = (
- (os.environ.get(k), v)
- for k, v in _LEGACY_ENVIRONMENT_VARIABLES.iteritems())
+def EmptyConfig():
return {
rnephew (Reviews Here) 2016/08/22 15:36:16 Like these improvements a lot.
'config_type': 'BaseConfig',
- 'dependencies': {
- c['dependency_name']: {
- 'file_info': {
- c['platform']: {
- 'local_paths': [p],
- },
+ 'dependencies': {}
+ }
+
+
+def LocalConfigItem(dependency_name, dependency_platform, dependency_path):
+ if isinstance(dependency_path, basestring):
+ dependency_path = [dependency_path]
+ return {
+ dependency_name: {
+ 'file_info': {
+ dependency_platform: {
+ 'local_paths': dependency_path
},
- } for p, c in path_config if p
+ },
},
}
+def _GetEnvironmentVariableConfig():
+ env_config = EmptyConfig()
+ path_config = (
+ (os.environ.get(k), v)
+ for k, v in _LEGACY_ENVIRONMENT_VARIABLES.iteritems())
+ path_config = ((p, c) for p, c in path_config if p)
+ for p, c in path_config:
+ env_config['dependencies'].update(
+ LocalConfigItem(c['dependency_name'], c['platform'], p))
+ return env_config
+
+
class _Environment(object):
def __init__(self):
« no previous file with comments | « devil/devil/android/tools/script_common.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698