From 7f32efcb64e86f6e059adcc7d6f62fcacdc4e1ea Mon Sep 17 00:00:00 2001 From: Javi Merino Date: Tue, 15 Dec 2015 13:43:56 +0000 Subject: [PATCH] android: fix initialization without android In workload automation, utils.android._initialize_without_android_home() gets android_home from adb's path. When this code was copied to devlib, we mistakenly dropped parsing the output of "which" and instead call os.path.dirname() on "adb", which always returns "" and makes _initialize_without_android_home() fail. Make _initialize_without_android_home() parse the output of "which" again. --- devlib/utils/android.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/devlib/utils/android.py b/devlib/utils/android.py index 7c5d62c..c0268ca 100644 --- a/devlib/utils/android.py +++ b/devlib/utils/android.py @@ -383,13 +383,14 @@ def _initialize_with_android_home(env): def _initialize_without_android_home(env): - if which('adb'): + adb_full_path = which('adb') + if adb_full_path: env.adb = 'adb' else: raise HostError('ANDROID_HOME is not set and adb is not in PATH. ' 'Have you installed Android SDK?') logger.debug('Discovering ANDROID_HOME from adb path.') - env.platform_tools = os.path.dirname(env.adb) + env.platform_tools = os.path.dirname(adb_full_path) env.android_home = os.path.dirname(env.platform_tools) _init_common(env) return env