Commit bcf60fea authored by bulach@chromium.org's avatar bulach@chromium.org

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
parent 63fe6444
...@@ -2,3 +2,18 @@ ...@@ -2,3 +2,18 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # 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'))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment