OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Defines a set of constants shared by test runners and other scripts.""" | 5 """Defines a set of constants shared by test runners and other scripts.""" |
6 | 6 |
7 import os | 7 import os |
8 import subprocess | 8 import subprocess |
9 import sys | 9 import sys |
10 | 10 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 def _GetADBPath(): | 86 def _GetADBPath(): |
87 if os.environ.get('ANDROID_SDK_ROOT'): | 87 if os.environ.get('ANDROID_SDK_ROOT'): |
88 return 'adb' | 88 return 'adb' |
89 # If envsetup.sh hasn't been sourced and there's no adb in the path, | 89 # If envsetup.sh hasn't been sourced and there's no adb in the path, |
90 # set it here. | 90 # set it here. |
91 try: | 91 try: |
92 with file(os.devnull, 'w') as devnull: | 92 with file(os.devnull, 'w') as devnull: |
93 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull) | 93 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull) |
94 return 'adb' | 94 return 'adb' |
95 except OSError: | 95 except OSError: |
96 print 'No adb found in $PATH, fallback to checked in binary.' | 96 print >> sys.stderr, 'No adb found in $PATH, fallback to checked in binary.' |
97 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb') | 97 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb') |
98 | 98 |
99 | 99 |
100 ADB_PATH = _GetADBPath() | 100 ADB_PATH = _GetADBPath() |
OLD | NEW |