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 datetime | 9 import datetime |
10 import json | 10 import json |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 return 'solaris' | 45 return 'solaris' |
46 else: | 46 else: |
47 return None | 47 return None |
48 | 48 |
49 | 49 |
50 # Try to guess the host architecture. | 50 # Try to guess the host architecture. |
51 def GuessArchitecture(): | 51 def GuessArchitecture(): |
52 os_id = platform.machine() | 52 os_id = platform.machine() |
53 if os_id.startswith('armv5te'): | 53 if os_id.startswith('armv5te'): |
54 return 'armv5te' | 54 return 'armv5te' |
| 55 elif os_id.startswith('armv6'): |
| 56 return 'armv6' |
55 elif os_id.startswith('arm'): | 57 elif os_id.startswith('arm'): |
56 return 'arm' | 58 return 'arm' |
57 elif os_id.startswith('aarch64'): | 59 elif os_id.startswith('aarch64'): |
58 return 'arm64' | 60 return 'arm64' |
59 elif os_id.startswith('mips'): | 61 elif os_id.startswith('mips'): |
60 return 'mips' | 62 return 'mips' |
61 elif '64' in os_id: | 63 elif '64' in os_id: |
62 return 'x64' | 64 return 'x64' |
63 elif (not os_id) or (not re.match('(x|i[3-6])86', os_id) is None): | 65 elif (not os_id) or (not re.match('(x|i[3-6])86', os_id) is None): |
64 return 'ia32' | 66 return 'ia32' |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 'win32': os.path.join('build'), | 223 'win32': os.path.join('build'), |
222 'linux': os.path.join('out'), | 224 'linux': os.path.join('out'), |
223 'freebsd': os.path.join('out'), | 225 'freebsd': os.path.join('out'), |
224 'macos': os.path.join('xcodebuild'), | 226 'macos': os.path.join('xcodebuild'), |
225 } | 227 } |
226 | 228 |
227 ARCH_FAMILY = { | 229 ARCH_FAMILY = { |
228 'ia32': 'ia32', | 230 'ia32': 'ia32', |
229 'x64': 'ia32', | 231 'x64': 'ia32', |
230 'arm': 'arm', | 232 'arm': 'arm', |
| 233 'armv6': 'arm', |
231 'armv5te': 'arm', | 234 'armv5te': 'arm', |
232 'arm64': 'arm', | 235 'arm64': 'arm', |
233 'mips': 'mips', | 236 'mips': 'mips', |
234 'simarm': 'ia32', | 237 'simarm': 'ia32', |
| 238 'simarmv6': 'ia32', |
235 'simarmv5te': 'ia32', | 239 'simarmv5te': 'ia32', |
236 'simmips': 'ia32', | 240 'simmips': 'ia32', |
237 'simarm64': 'ia32', | 241 'simarm64': 'ia32', |
238 } | 242 } |
239 | 243 |
240 ARCH_GUESS = GuessArchitecture() | 244 ARCH_GUESS = GuessArchitecture() |
241 BASE_DIR = os.path.abspath(os.path.join(os.curdir, '..')) | 245 BASE_DIR = os.path.abspath(os.path.join(os.curdir, '..')) |
242 DART_DIR = os.path.abspath(os.path.join(__file__, '..', '..')) | 246 DART_DIR = os.path.abspath(os.path.join(__file__, '..', '..')) |
243 VERSION_FILE = os.path.join(DART_DIR, 'tools', 'VERSION') | 247 VERSION_FILE = os.path.join(DART_DIR, 'tools', 'VERSION') |
244 | 248 |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 dart_binary_prefix = os.path.join(tools_dir, 'testing', 'bin') | 578 dart_binary_prefix = os.path.join(tools_dir, 'testing', 'bin') |
575 if IsWindows(): | 579 if IsWindows(): |
576 return os.path.join(dart_binary_prefix, 'windows', 'dart.exe') | 580 return os.path.join(dart_binary_prefix, 'windows', 'dart.exe') |
577 else: | 581 else: |
578 arch = GuessArchitecture() | 582 arch = GuessArchitecture() |
579 system = GuessOS() | 583 system = GuessOS() |
580 if arch == 'armv5te': | 584 if arch == 'armv5te': |
581 # TODO(zra): This binary does not exist, yet. Check one in once we have | 585 # TODO(zra): This binary does not exist, yet. Check one in once we have |
582 # sufficient stability. | 586 # sufficient stability. |
583 return os.path.join(dart_binary_prefix, system, 'dart-armv5te') | 587 return os.path.join(dart_binary_prefix, system, 'dart-armv5te') |
| 588 elif arch == 'armv6': |
| 589 # TODO(zra): Ditto. |
| 590 return os.path.join(dart_binary_prefix, system, 'dart-armv6') |
584 elif arch == 'arm': | 591 elif arch == 'arm': |
585 return os.path.join(dart_binary_prefix, system, 'dart-arm') | 592 return os.path.join(dart_binary_prefix, system, 'dart-arm') |
586 elif arch == 'arm64': | 593 elif arch == 'arm64': |
587 return os.path.join(dart_binary_prefix, system, 'dart-arm64') | 594 return os.path.join(dart_binary_prefix, system, 'dart-arm64') |
588 elif arch == 'mips': | 595 elif arch == 'mips': |
589 return os.path.join(dart_binary_prefix, system, 'dart-mips') | 596 return os.path.join(dart_binary_prefix, system, 'dart-mips') |
590 else: | 597 else: |
591 return os.path.join(dart_binary_prefix, system, 'dart') | 598 return os.path.join(dart_binary_prefix, system, 'dart') |
592 | 599 |
593 | 600 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 os.chdir(self._working_directory) | 673 os.chdir(self._working_directory) |
667 | 674 |
668 def __exit__(self, *_): | 675 def __exit__(self, *_): |
669 print "Enter directory = ", self._old_cwd | 676 print "Enter directory = ", self._old_cwd |
670 os.chdir(self._old_cwd) | 677 os.chdir(self._old_cwd) |
671 | 678 |
672 | 679 |
673 if __name__ == "__main__": | 680 if __name__ == "__main__": |
674 import sys | 681 import sys |
675 Main() | 682 Main() |
OLD | NEW |