diff options
author | bulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-28 14:27:33 +0000 |
---|---|---|
committer | bulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-28 14:27:33 +0000 |
commit | bcf60feab123cdb2f02a2b5ba4cdc949b220e98b (patch) | |
tree | 61c59726d22f1e4b991d25060100bcf1072d7db4 /build | |
parent | 63fe6444035de0e76c647d575248ba79feec0266 (diff) | |
download | chromium_src-bcf60feab123cdb2f02a2b5ba4cdc949b220e98b.zip chromium_src-bcf60feab123cdb2f02a2b5ba4cdc949b220e98b.tar.gz chromium_src-bcf60feab123cdb2f02a2b5ba4cdc949b220e98b.tar.bz2 |
Android: allows using adb from a chromium checkout without envsetup.sh
There are situations like running tests where it's not necessary to run envsetup.sh.
However, build/android/pylib requires adb to be in the path.
Rather than requiring envsetup, it can be smart enough to set the path itself.
BUG=242960
Review URL: https://chromiumcodereview.appspot.com/15891002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202558 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build')
-rw-r--r-- | build/android/pylib/__init__.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/build/android/pylib/__init__.py b/build/android/pylib/__init__.py index 727e987..ba6323e 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. + with file(os.devnull, 'w') as devnull: + ret = subprocess.call(['which', 'adb'], stdout=devnull, stderr=devnull) + if ret: + 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__), + '..', '..', '..', + 'third_party', 'android_tools', 'sdk', 'platform-tools')) |