Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: build/android/pylib/constants.py

Issue 117333008: Silence warning about falling back to checked-in adb binary (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move function closer to use. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « build/android/pylib/android_commands.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 collections 7 import collections
8 import logging
8 import os 9 import os
9 import subprocess 10 import subprocess
10 import sys 11 import sys
11 12
12 13
13 DIR_SOURCE_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), 14 DIR_SOURCE_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__),
14 os.pardir, os.pardir, os.pardir)) 15 os.pardir, os.pardir, os.pardir))
15 ISOLATE_DEPS_DIR = os.path.join(DIR_SOURCE_ROOT, 'isolate_deps_dir') 16 ISOLATE_DEPS_DIR = os.path.join(DIR_SOURCE_ROOT, 'isolate_deps_dir')
16 17
17 CHROMIUM_TEST_SHELL_HOST_DRIVEN_DIR = os.path.join( 18 CHROMIUM_TEST_SHELL_HOST_DRIVEN_DIR = os.path.join(
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 152
152 Args: 153 Args:
153 build_type: Build type, generally 'Debug' or 'Release'. Defaults to the 154 build_type: Build type, generally 'Debug' or 'Release'. Defaults to the
154 globally set build type environment variable BUILDTYPE. 155 globally set build type environment variable BUILDTYPE.
155 """ 156 """
156 return os.path.abspath(os.path.join( 157 return os.path.abspath(os.path.join(
157 DIR_SOURCE_ROOT, os.environ.get('CHROMIUM_OUT_DIR', 'out'), 158 DIR_SOURCE_ROOT, os.environ.get('CHROMIUM_OUT_DIR', 'out'),
158 GetBuildType() if build_type is None else build_type)) 159 GetBuildType() if build_type is None else build_type))
159 160
160 161
161 def _GetADBPath(): 162 def _Memoize(func):
163 def Wrapper():
164 try:
165 return func._result
166 except AttributeError:
167 func._result = func()
168 return func._result
169 return Wrapper
170
171
172 @_Memoize
173 def GetAdbPath():
162 if os.environ.get('ANDROID_SDK_ROOT'): 174 if os.environ.get('ANDROID_SDK_ROOT'):
163 return 'adb' 175 return 'adb'
164 # If envsetup.sh hasn't been sourced and there's no adb in the path, 176 # If envsetup.sh hasn't been sourced and there's no adb in the path,
165 # set it here. 177 # set it here.
166 try: 178 try:
167 with file(os.devnull, 'w') as devnull: 179 with file(os.devnull, 'w') as devnull:
168 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull) 180 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull)
169 return 'adb' 181 return 'adb'
170 except OSError: 182 except OSError:
171 print >> sys.stderr, 'No adb found in $PATH, fallback to checked in binary.' 183 logging.debug('No adb found in $PATH, fallback to checked in binary.')
172 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb') 184 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb')
173 185
174 186
175 ADB_PATH = _GetADBPath()
176
177 # Exit codes 187 # Exit codes
178 ERROR_EXIT_CODE = 1 188 ERROR_EXIT_CODE = 1
179 WARNING_EXIT_CODE = 88 189 WARNING_EXIT_CODE = 88
OLDNEW
« no previous file with comments | « build/android/pylib/android_commands.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698