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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 try: | 87 try: |
88 return os.environ['BUILDTYPE'] | 88 return os.environ['BUILDTYPE'] |
89 except KeyError: | 89 except KeyError: |
90 raise Exception('The BUILDTYPE environment variable has not been set') | 90 raise Exception('The BUILDTYPE environment variable has not been set') |
91 | 91 |
92 | 92 |
93 def SetBuildType(build_type): | 93 def SetBuildType(build_type): |
94 os.environ['BUILDTYPE'] = build_type | 94 os.environ['BUILDTYPE'] = build_type |
95 | 95 |
96 | 96 |
97 def GetBuildDirectory(): | |
98 return os.path.abspath( | |
99 os.path.join(cmd_helper.OutDirectory.get(), GetBuildType())) | |
frankf
2013/08/21 01:50:07
Remove cmd_helper.OutDirectory alltogether.
craigdh
2013/08/22 22:09:42
Done.
| |
100 | |
101 | |
97 def _GetADBPath(): | 102 def _GetADBPath(): |
98 if os.environ.get('ANDROID_SDK_ROOT'): | 103 if os.environ.get('ANDROID_SDK_ROOT'): |
99 return 'adb' | 104 return 'adb' |
100 # If envsetup.sh hasn't been sourced and there's no adb in the path, | 105 # If envsetup.sh hasn't been sourced and there's no adb in the path, |
101 # set it here. | 106 # set it here. |
102 try: | 107 try: |
103 with file(os.devnull, 'w') as devnull: | 108 with file(os.devnull, 'w') as devnull: |
104 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull) | 109 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull) |
105 return 'adb' | 110 return 'adb' |
106 except OSError: | 111 except OSError: |
107 print >> sys.stderr, 'No adb found in $PATH, fallback to checked in binary.' | 112 print >> sys.stderr, 'No adb found in $PATH, fallback to checked in binary.' |
108 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb') | 113 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb') |
109 | 114 |
110 | 115 |
111 ADB_PATH = _GetADBPath() | 116 ADB_PATH = _GetADBPath() |
112 | 117 |
113 # Exit codes | 118 # Exit codes |
114 ERROR_EXIT_CODE = 1 | 119 ERROR_EXIT_CODE = 1 |
115 WARNING_EXIT_CODE = 88 | 120 WARNING_EXIT_CODE = 88 |
OLD | NEW |