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

Unified Diff: build/android/pylib/constants.py

Issue 711113002: Add option to specify ADB binary in test runner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Decided to move where ADB added to path to test_runner.py Created 6 years, 1 month 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
Index: build/android/pylib/constants.py
diff --git a/build/android/pylib/constants.py b/build/android/pylib/constants.py
index befb04acd24d97956781da9ea65f0ba2a64333d3..5abfd5abaa548abd0e278ee517c461e3a8fb233c 100644
--- a/build/android/pylib/constants.py
+++ b/build/android/pylib/constants.py
@@ -238,8 +238,21 @@ def _Memoize(func):
return Wrapper
-@_Memoize
+def SetAdbPath(adb_path):
+ os.environ['ADB_PATH'] = adb_path
+
+
def GetAdbPath():
jbudorick 2014/11/11 15:27:23 Why is this separate from _FindAdbPath?
mikecase (-- gone --) 2014/11/11 17:56:41 So I can keep the @_Memoize decorator on the logic
jbudorick 2014/11/11 18:04:03 Urgh, we need to rework these "constants." SetAdb
+ # Check if a custom adb path as been set. If not, try to find adb
+ # on the system.
+ if os.environ.get('ADB_PATH'):
+ return os.environ.get('ADB_PATH')
+ else:
+ return _FindAdbPath()
+
+
+@_Memoize
+def _FindAdbPath():
if os.environ.get('ANDROID_SDK_ROOT'):
return 'adb'
# If envsetup.sh hasn't been sourced and there's no adb in the path,
@@ -252,7 +265,6 @@ def GetAdbPath():
logging.debug('No adb found in $PATH, fallback to checked in binary.')
return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb')
-
# Exit codes
ERROR_EXIT_CODE = 1
WARNING_EXIT_CODE = 88

Powered by Google App Engine
This is Rietveld 408576698