| OLD | NEW |
| 1 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2012, 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 if platform.system() == 'Windows': | 235 if platform.system() == 'Windows': |
| 236 gsutil = 'e:\\\\b\\build\\scripts\\slave\\gsutil' | 236 gsutil = 'e:\\\\b\\build\\scripts\\slave\\gsutil' |
| 237 return gsutil | 237 return gsutil |
| 238 | 238 |
| 239 def GetBuildMode(mode): | 239 def GetBuildMode(mode): |
| 240 return BUILD_MODES[mode] | 240 return BUILD_MODES[mode] |
| 241 | 241 |
| 242 def GetArchFamily(arch): | 242 def GetArchFamily(arch): |
| 243 return ARCH_FAMILY[arch] | 243 return ARCH_FAMILY[arch] |
| 244 | 244 |
| 245 def IsCrossBuild(target_os, arch): |
| 246 host_arch = ARCH_GUESS |
| 247 return ((GetArchFamily(host_arch) != GetArchFamily(arch)) or |
| 248 (target_os != GuessOS())) |
| 249 |
| 245 def GetBuildConf(mode, arch, conf_os=None): | 250 def GetBuildConf(mode, arch, conf_os=None): |
| 246 if conf_os == 'android': | 251 if conf_os == 'android': |
| 247 return '%s%s%s' % (GetBuildMode(mode), conf_os.title(), arch.upper()) | 252 return '%s%s%s' % (GetBuildMode(mode), conf_os.title(), arch.upper()) |
| 248 else: | 253 else: |
| 249 # Ask for a cross build if the host and target architectures don't match. | 254 # Ask for a cross build if the host and target architectures don't match. |
| 250 host_arch = ARCH_GUESS | 255 host_arch = ARCH_GUESS |
| 251 cross_build = '' | 256 cross_build = '' |
| 252 if GetArchFamily(host_arch) != GetArchFamily(arch): | 257 if GetArchFamily(host_arch) != GetArchFamily(arch): |
| 253 print "GetBuildConf: Cross-build of %s on %s\n" % (arch, host_arch) | 258 print "GetBuildConf: Cross-build of %s on %s\n" % (arch, host_arch) |
| 254 cross_build = 'X' | 259 cross_build = 'X' |
| 255 return '%s%s%s' % (GetBuildMode(mode), cross_build, arch.upper()) | 260 return '%s%s%s' % (GetBuildMode(mode), cross_build, arch.upper()) |
| 256 | 261 |
| 257 def GetBuildDir(host_os, target_os): | 262 def GetBuildDir(host_os, target_os): |
| 258 return BUILD_ROOT[host_os] | 263 return BUILD_ROOT[host_os] |
| 259 | 264 |
| 260 def GetBuildRoot(host_os, mode=None, arch=None, target_os=None): | 265 def GetBuildRoot(host_os, mode=None, arch=None, target_os=None): |
| 261 build_root = GetBuildDir(host_os, target_os) | 266 build_root = GetBuildDir(host_os, target_os) |
| 262 if mode: | 267 if mode: |
| 263 build_root = os.path.join(build_root, GetBuildConf(mode, arch)) | 268 build_root = os.path.join(build_root, GetBuildConf(mode, arch, target_os)) |
| 264 return build_root | 269 return build_root |
| 265 | 270 |
| 266 def GetBaseDir(): | 271 def GetBaseDir(): |
| 267 return BASE_DIR | 272 return BASE_DIR |
| 268 | 273 |
| 269 def GetShortVersion(): | 274 def GetShortVersion(): |
| 270 version = ReadVersionFile() | 275 version = ReadVersionFile() |
| 271 return ('%s.%s.%s.%s.%s' % ( | 276 return ('%s.%s.%s.%s.%s' % ( |
| 272 version.major, version.minor, version.patch, version.prerelease, | 277 version.major, version.minor, version.patch, version.prerelease, |
| 273 version.prerelease_patch)) | 278 version.prerelease_patch)) |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 os.chdir(self._working_directory) | 589 os.chdir(self._working_directory) |
| 585 | 590 |
| 586 def __exit__(self, *_): | 591 def __exit__(self, *_): |
| 587 print "Enter directory = ", self._old_cwd | 592 print "Enter directory = ", self._old_cwd |
| 588 os.chdir(self._old_cwd) | 593 os.chdir(self._old_cwd) |
| 589 | 594 |
| 590 | 595 |
| 591 if __name__ == "__main__": | 596 if __name__ == "__main__": |
| 592 import sys | 597 import sys |
| 593 Main(sys.argv) | 598 Main(sys.argv) |
| OLD | NEW |