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

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

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

Powered by Google App Engine
This is Rietveld 408576698