| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 global BUILD_MODES | 128 global BUILD_MODES |
| 129 return BUILD_MODES[mode] | 129 return BUILD_MODES[mode] |
| 130 | 130 |
| 131 | 131 |
| 132 def GetBuildConf(mode, arch): | 132 def GetBuildConf(mode, arch): |
| 133 return '%s%s' % (GetBuildMode(mode), arch.upper()) | 133 return '%s%s' % (GetBuildMode(mode), arch.upper()) |
| 134 | 134 |
| 135 ARCH_GUESS = GuessArchitecture() | 135 ARCH_GUESS = GuessArchitecture() |
| 136 BASE_DIR = os.path.abspath(os.path.join(os.curdir, '..')) | 136 BASE_DIR = os.path.abspath(os.path.join(os.curdir, '..')) |
| 137 | 137 |
| 138 def GetBuildRoot(target_os, mode=None, arch=None): | 138 |
| 139 def GetBuildDir(host_os, target_os): |
| 139 global BUILD_ROOT | 140 global BUILD_ROOT |
| 141 build_dir = BUILD_ROOT[host_os] |
| 142 if target_os and target_os != host_os: |
| 143 build_dir = os.path.join(build_dir, target_os) |
| 144 return build_dir |
| 145 |
| 146 def GetBuildRoot(host_os, mode=None, arch=None, target_os=None): |
| 147 build_root = GetBuildDir(host_os, target_os) |
| 140 if mode: | 148 if mode: |
| 141 return os.path.join(BUILD_ROOT[target_os], GetBuildConf(mode, arch)) | 149 build_root = os.path.join(build_root, GetBuildConf(mode, arch)) |
| 142 else: | 150 return build_root |
| 143 return BUILD_ROOT[target_os] | |
| 144 | 151 |
| 145 def GetBaseDir(): | 152 def GetBaseDir(): |
| 146 return BASE_DIR | 153 return BASE_DIR |
| 147 | 154 |
| 148 def GetSVNRevision(): | 155 def GetSVNRevision(): |
| 149 p = subprocess.Popen(['svn', 'info'], stdout = subprocess.PIPE, | 156 p = subprocess.Popen(['svn', 'info'], stdout = subprocess.PIPE, |
| 150 stderr = subprocess.STDOUT, shell=IsWindows()) | 157 stderr = subprocess.STDOUT, shell=IsWindows()) |
| 151 output, not_used = p.communicate() | 158 output, not_used = p.communicate() |
| 152 revision = ParseSvnInfoOutput(output) | 159 revision = ParseSvnInfoOutput(output) |
| 153 if revision: | 160 if revision: |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 293 |
| 287 | 294 |
| 288 def Touch(name): | 295 def Touch(name): |
| 289 with file(name, 'a'): | 296 with file(name, 'a'): |
| 290 os.utime(name, None) | 297 os.utime(name, None) |
| 291 | 298 |
| 292 | 299 |
| 293 if __name__ == "__main__": | 300 if __name__ == "__main__": |
| 294 import sys | 301 import sys |
| 295 Main(sys.argv) | 302 Main(sys.argv) |
| OLD | NEW |