Chromium Code Reviews| 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 |