OLD | NEW |
1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 # for details. All rights reserved. Use of this source code is governed by a | 2 # for details. All rights reserved. Use of this source code is governed by a |
3 # BSD-style license that can be found in the LICENSE file. | 3 # BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 # This file contains a set of utilities functions used by other Python-based | 5 # This file contains a set of utilities functions used by other Python-based |
6 # scripts. | 6 # scripts. |
7 | 7 |
8 import commands | 8 import commands |
9 import os | 9 import os |
10 import platform | 10 import platform |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } | 123 } |
124 | 124 |
125 def GetBuildMode(mode): | 125 def GetBuildMode(mode): |
126 global BUILD_MODES | 126 global BUILD_MODES |
127 return BUILD_MODES[mode] | 127 return BUILD_MODES[mode] |
128 | 128 |
129 | 129 |
130 def GetBuildConf(mode, arch): | 130 def GetBuildConf(mode, arch): |
131 return GetBuildMode(mode) + "_" + arch | 131 return GetBuildMode(mode) + "_" + arch |
132 | 132 |
133 # Temporary variables that we should remove once the buildbots build 'ia32' | |
134 # instead of 'dartc'. | |
135 RUN_FROM_TOP_DIR = os.path.basename(os.path.abspath(os.curdir)) == 'dart' | |
136 ARCH_GUESS = GuessArchitecture() | 133 ARCH_GUESS = GuessArchitecture() |
137 BASE_DIR = os.path.abspath(os.path.join(os.curdir, '..')) | 134 BASE_DIR = os.path.abspath(os.path.join(os.curdir, '..')) |
138 if RUN_FROM_TOP_DIR: | |
139 BASE_DIR = os.path.abspath(os.curdir) | |
140 | 135 |
141 def GetBuildRoot(target_os, mode=None, arch=None): | 136 def GetBuildRoot(target_os, mode=None, arch=None): |
142 if arch == 'dartc' and RUN_FROM_TOP_DIR: arch = ARCH_GUESS | |
143 global BUILD_ROOT | 137 global BUILD_ROOT |
144 if mode: | 138 if mode: |
145 return os.path.join(BUILD_ROOT[target_os], GetBuildConf(mode, arch)) | 139 path = os.path.join(BUILD_ROOT[target_os], GetBuildConf(mode, arch)) |
| 140 # TODO(ngeoffray): Remove this test once the testing infrastructure does not |
| 141 # treat 'dartc' as an arch. |
| 142 if not os.path.exists(path) and arch == 'dartc': |
| 143 path = os.path.join(BUILD_ROOT[target_os], GetBuildConf(mode, ARCH_GUESS)) |
| 144 return path; |
146 else: | 145 else: |
147 return BUILD_ROOT[target_os] | 146 return BUILD_ROOT[target_os] |
148 | 147 |
149 def GetBaseDir(): | 148 def GetBaseDir(): |
150 return BASE_DIR | 149 return BASE_DIR |
151 | 150 |
152 def RewritePathSeparator(path, workspace): | 151 def RewritePathSeparator(path, workspace): |
153 # Paths in test files are always specified using '/' | 152 # Paths in test files are always specified using '/' |
154 # as the path separator. Replace with the actual | 153 # as the path separator. Replace with the actual |
155 # path separator before use. | 154 # path separator before use. |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 def __init__(self, value): | 247 def __init__(self, value): |
249 self.value = value | 248 self.value = value |
250 | 249 |
251 def __str__(self): | 250 def __str__(self): |
252 return repr(self.value) | 251 return repr(self.value) |
253 | 252 |
254 | 253 |
255 if __name__ == "__main__": | 254 if __name__ == "__main__": |
256 import sys | 255 import sys |
257 Main(sys.argv) | 256 Main(sys.argv) |
OLD | NEW |