| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 def GetBuildRoot(target_os, mode=None, arch=None): | 154 def GetBuildRoot(target_os, mode=None, arch=None): |
| 155 global BUILD_ROOT | 155 global BUILD_ROOT |
| 156 if mode: | 156 if mode: |
| 157 return os.path.join(BUILD_ROOT[target_os], GetBuildConf(mode, arch)) | 157 return os.path.join(BUILD_ROOT[target_os], GetBuildConf(mode, arch)) |
| 158 else: | 158 else: |
| 159 return BUILD_ROOT[target_os] | 159 return BUILD_ROOT[target_os] |
| 160 | 160 |
| 161 def GetBaseDir(): | 161 def GetBaseDir(): |
| 162 return BASE_DIR | 162 return BASE_DIR |
| 163 | 163 |
| 164 def GetSVNRevision(): |
| 165 p = subprocess.Popen(['svn', 'info'], stdout = subprocess.PIPE, |
| 166 stderr = subprocess.STDOUT, shell=IsWindows()) |
| 167 output, not_used = p.communicate() |
| 168 for line in output.split('\n'): |
| 169 if 'Revision' in line: |
| 170 return (line.strip().split())[1] |
| 171 return None |
| 172 |
| 164 def RewritePathSeparator(path, workspace): | 173 def RewritePathSeparator(path, workspace): |
| 165 # Paths in test files are always specified using '/' | 174 # Paths in test files are always specified using '/' |
| 166 # as the path separator. Replace with the actual | 175 # as the path separator. Replace with the actual |
| 167 # path separator before use. | 176 # path separator before use. |
| 168 if ('/' in path): | 177 if ('/' in path): |
| 169 split_path = path.split('/') | 178 split_path = path.split('/') |
| 170 path = os.sep.join(split_path) | 179 path = os.sep.join(split_path) |
| 171 path = os.path.join(workspace, path) | 180 path = os.path.join(workspace, path) |
| 172 if not os.path.exists(path): | 181 if not os.path.exists(path): |
| 173 raise Exception(path) | 182 raise Exception(path) |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 282 |
| 274 def DiagnoseExitCode(exit_code, command): | 283 def DiagnoseExitCode(exit_code, command): |
| 275 if IsCrashExitCode(exit_code): | 284 if IsCrashExitCode(exit_code): |
| 276 sys.stderr.write('Command: %s\nCRASHED with exit code %d (0x%x)\n' % ( | 285 sys.stderr.write('Command: %s\nCRASHED with exit code %d (0x%x)\n' % ( |
| 277 ' '.join(command), exit_code, exit_code & 0xffffffff)) | 286 ' '.join(command), exit_code, exit_code & 0xffffffff)) |
| 278 | 287 |
| 279 | 288 |
| 280 if __name__ == "__main__": | 289 if __name__ == "__main__": |
| 281 import sys | 290 import sys |
| 282 Main(sys.argv) | 291 Main(sys.argv) |
| OLD | NEW |