| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 else: | 142 else: |
| 143 return BUILD_ROOT[target_os] | 143 return BUILD_ROOT[target_os] |
| 144 | 144 |
| 145 def GetBaseDir(): | 145 def GetBaseDir(): |
| 146 return BASE_DIR | 146 return BASE_DIR |
| 147 | 147 |
| 148 def GetSVNRevision(): | 148 def GetSVNRevision(): |
| 149 p = subprocess.Popen(['svn', 'info'], stdout = subprocess.PIPE, | 149 p = subprocess.Popen(['svn', 'info'], stdout = subprocess.PIPE, |
| 150 stderr = subprocess.STDOUT, shell=IsWindows()) | 150 stderr = subprocess.STDOUT, shell=IsWindows()) |
| 151 output, not_used = p.communicate() | 151 output, not_used = p.communicate() |
| 152 revision = ParseSvnInfoOutput(output) |
| 153 if revision: |
| 154 return revision |
| 155 |
| 156 # maybe the builder is using git-svn, try that |
| 157 p = subprocess.Popen(['git', 'svn', 'info'], stdout = subprocess.PIPE, |
| 158 stderr = subprocess.STDOUT, shell=IsWindows()) |
| 159 output, not_used = p.communicate() |
| 160 revision = ParseSvnInfoOutput(output) |
| 161 if revision: |
| 162 return revision |
| 163 |
| 164 return None |
| 165 |
| 166 def ParseSvnInfoOutput(output): |
| 152 for line in output.split('\n'): | 167 for line in output.split('\n'): |
| 153 if 'Revision' in line: | 168 if 'Revision' in line: |
| 154 return (line.strip().split())[1] | 169 return (line.strip().split())[1] |
| 155 return None | 170 return None |
| 156 | 171 |
| 157 def RewritePathSeparator(path, workspace): | 172 def RewritePathSeparator(path, workspace): |
| 158 # Paths in test files are always specified using '/' | 173 # Paths in test files are always specified using '/' |
| 159 # as the path separator. Replace with the actual | 174 # as the path separator. Replace with the actual |
| 160 # path separator before use. | 175 # path separator before use. |
| 161 if ('/' in path): | 176 if ('/' in path): |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 286 |
| 272 | 287 |
| 273 def Touch(name): | 288 def Touch(name): |
| 274 with file(name, 'a'): | 289 with file(name, 'a'): |
| 275 os.utime(name, None) | 290 os.utime(name, None) |
| 276 | 291 |
| 277 | 292 |
| 278 if __name__ == "__main__": | 293 if __name__ == "__main__": |
| 279 import sys | 294 import sys |
| 280 Main(sys.argv) | 295 Main(sys.argv) |
| OLD | NEW |