Windows perf bots: fixes android pylib initialization.

Following crrev.com/202558, android's pylib was initialized on platforms that didn't need.
Check for platform and also make it safer to use should there be problems with "which".

BUG=242960
R=tonyg@chromium.org

Review URL: https://codereview.chromium.org/15804004

git-svn-id: http://src.chromium.org/svn/trunk/src/build@202669 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
jchaffraix@chromium.org 2013-05-28 22:25:07 +00:00
Родитель 049c9608c5
Коммит 5604e4d8c8
1 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -4,14 +4,16 @@
import os
import subprocess
import sys
if not os.environ.get('ANDROID_SDK_ROOT'):
if sys.platform == 'linux2' and 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:
try:
with file(os.devnull, 'w') as devnull:
subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull)
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__),