Index: build/android/pylib/__init__.py |
diff --git a/build/android/pylib/__init__.py b/build/android/pylib/__init__.py |
index 727e987e6b621957ed56f20af1968525a9abadcf..4abf9b0b54fe2337960f53ccb8bde9ee3102c517 100644 |
--- a/build/android/pylib/__init__.py |
+++ b/build/android/pylib/__init__.py |
@@ -2,3 +2,18 @@ |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
+import os |
+import subprocess |
+ |
+ |
+if not os.environ.get('ANDROID_SDK_ROOT'): |
+ # If envsetup.sh hasn't been sourced and there's no adb in the path, |
+ # set it here. |
+ try: |
+ subprocess.call(['adb', 'version']) |
Isaac (away)
2013/05/24 19:17:01
How about 'which adb' instead? Also you need to p
bulach
2013/05/28 09:12:25
good points, done both.
|
+ except OSError: |
+ print 'No adb found in $PATH, fallback to checked in binary.' |
+ os.environ['PATH'] += os.pathsep + os.path.abspath(os.path.join( |
+ os.path.dirname(__file__), |
+ '..', '..', '..', |
Isaac (away)
2013/05/24 19:17:01
can we import constants.py and use the sdk_dir her
bulach
2013/05/28 09:12:25
I don't think so, this is the module's __init__, I
|
+ 'third_party', 'android_tools', 'sdk', 'platform-tools')) |