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

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

Issue 23926012: Revert 221736 "[android] Adds constants.GetOutDirectory() and co..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 months 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
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 os 8 import os
9 import subprocess 9 import subprocess
10 import sys 10 import sys
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 try: 125 try:
126 return os.environ['BUILDTYPE'] 126 return os.environ['BUILDTYPE']
127 except KeyError: 127 except KeyError:
128 raise Exception('The BUILDTYPE environment variable has not been set') 128 raise Exception('The BUILDTYPE environment variable has not been set')
129 129
130 130
131 def SetBuildType(build_type): 131 def SetBuildType(build_type):
132 os.environ['BUILDTYPE'] = build_type 132 os.environ['BUILDTYPE'] = build_type
133 133
134 134
135 def GetOutDirectory(build_type=None):
136 """Returns the out directory where the output binaries are built.
137
138 Args:
139 build_type: Build type, generally 'Debug' or 'Release'. Defaults to the
140 globally set build type environment variable BUILDTYPE.
141 """
142 return os.path.abspath(os.path.join(
143 DIR_SOURCE_ROOT, os.environ.get('CHROMIUM_OUT_DIR', 'out'),
144 GetBuildType() if build_type is None else build_type))
145
146
147 def _GetADBPath(): 135 def _GetADBPath():
148 if os.environ.get('ANDROID_SDK_ROOT'): 136 if os.environ.get('ANDROID_SDK_ROOT'):
149 return 'adb' 137 return 'adb'
150 # If envsetup.sh hasn't been sourced and there's no adb in the path, 138 # If envsetup.sh hasn't been sourced and there's no adb in the path,
151 # set it here. 139 # set it here.
152 try: 140 try:
153 with file(os.devnull, 'w') as devnull: 141 with file(os.devnull, 'w') as devnull:
154 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull) 142 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull)
155 return 'adb' 143 return 'adb'
156 except OSError: 144 except OSError:
157 print >> sys.stderr, 'No adb found in $PATH, fallback to checked in binary.' 145 print >> sys.stderr, 'No adb found in $PATH, fallback to checked in binary.'
158 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb') 146 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb')
159 147
160 148
161 ADB_PATH = _GetADBPath() 149 ADB_PATH = _GetADBPath()
162 150
163 # Exit codes 151 # Exit codes
164 ERROR_EXIT_CODE = 1 152 ERROR_EXIT_CODE = 1
165 WARNING_EXIT_CODE = 88 153 WARNING_EXIT_CODE = 88
OLDNEW
« no previous file with comments | « trunk/src/build/android/pylib/cmd_helper.py ('k') | trunk/src/build/android/pylib/device_stats_monitor.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698