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 30 matching lines...) Expand all Loading... |
41 return 'openbsd' | 41 return 'openbsd' |
42 elif os_id == 'SunOS': | 42 elif os_id == 'SunOS': |
43 return 'solaris' | 43 return 'solaris' |
44 else: | 44 else: |
45 return None | 45 return None |
46 | 46 |
47 | 47 |
48 # Try to guess the host architecture. | 48 # Try to guess the host architecture. |
49 def GuessArchitecture(): | 49 def GuessArchitecture(): |
50 os_id = platform.machine() | 50 os_id = platform.machine() |
51 if os_id.startswith('arm'): | 51 if os_id.startswith('armv5'): |
| 52 return 'armv5' |
| 53 elif os_id.startswith('arm'): |
52 return 'arm' | 54 return 'arm' |
53 elif os_id.startswith('aarch64'): | 55 elif os_id.startswith('aarch64'): |
54 return 'arm64' | 56 return 'arm64' |
55 elif os_id.startswith('mips'): | 57 elif os_id.startswith('mips'): |
56 return 'mips' | 58 return 'mips' |
57 elif (not os_id) or (not re.match('(x|i[3-6])86', os_id) is None): | 59 elif (not os_id) or (not re.match('(x|i[3-6])86', os_id) is None): |
58 return 'ia32' | 60 return 'ia32' |
59 elif os_id == 'i86pc': | 61 elif os_id == 'i86pc': |
60 return 'ia32' | 62 return 'ia32' |
61 elif '64' in os_id: | 63 elif '64' in os_id: |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 'win32': os.path.join('build'), | 215 'win32': os.path.join('build'), |
214 'linux': os.path.join('out'), | 216 'linux': os.path.join('out'), |
215 'freebsd': os.path.join('out'), | 217 'freebsd': os.path.join('out'), |
216 'macos': os.path.join('xcodebuild'), | 218 'macos': os.path.join('xcodebuild'), |
217 } | 219 } |
218 | 220 |
219 ARCH_FAMILY = { | 221 ARCH_FAMILY = { |
220 'ia32': 'ia32', | 222 'ia32': 'ia32', |
221 'x64': 'ia32', | 223 'x64': 'ia32', |
222 'arm': 'arm', | 224 'arm': 'arm', |
| 225 'armv5': 'arm', |
223 'arm64': 'arm', | 226 'arm64': 'arm', |
224 'mips': 'mips', | 227 'mips': 'mips', |
225 'simarm': 'ia32', | 228 'simarm': 'ia32', |
226 'simmips': 'ia32', | 229 'simmips': 'ia32', |
227 'simarm64': 'ia32', | 230 'simarm64': 'ia32', |
228 } | 231 } |
229 | 232 |
230 ARCH_GUESS = GuessArchitecture() | 233 ARCH_GUESS = GuessArchitecture() |
231 BASE_DIR = os.path.abspath(os.path.join(os.curdir, '..')) | 234 BASE_DIR = os.path.abspath(os.path.join(os.curdir, '..')) |
232 DART_DIR = os.path.abspath(os.path.join(__file__, '..', '..')) | 235 DART_DIR = os.path.abspath(os.path.join(__file__, '..', '..')) |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 | 549 |
547 | 550 |
548 def DartBinary(): | 551 def DartBinary(): |
549 tools_dir = os.path.dirname(os.path.realpath(__file__)) | 552 tools_dir = os.path.dirname(os.path.realpath(__file__)) |
550 dart_binary_prefix = os.path.join(tools_dir, 'testing', 'bin') | 553 dart_binary_prefix = os.path.join(tools_dir, 'testing', 'bin') |
551 if IsWindows(): | 554 if IsWindows(): |
552 return os.path.join(dart_binary_prefix, 'windows', 'dart.exe') | 555 return os.path.join(dart_binary_prefix, 'windows', 'dart.exe') |
553 else: | 556 else: |
554 arch = GuessArchitecture() | 557 arch = GuessArchitecture() |
555 system = GuessOS() | 558 system = GuessOS() |
556 if arch == 'arm': | 559 if arch == 'armv5': |
| 560 # TODO(zra): This binary does not exist, yet. Check one in once we have |
| 561 # sufficient stability. |
| 562 return os.path.join(dart_binary_prefix, system, 'dart-armv5') |
| 563 elif arch == 'arm': |
557 return os.path.join(dart_binary_prefix, system, 'dart-arm') | 564 return os.path.join(dart_binary_prefix, system, 'dart-arm') |
558 elif arch == 'arm64': | 565 elif arch == 'arm64': |
559 return os.path.join(dart_binary_prefix, system, 'dart-arm64') | 566 return os.path.join(dart_binary_prefix, system, 'dart-arm64') |
560 elif arch == 'mips': | 567 elif arch == 'mips': |
561 return os.path.join(dart_binary_prefix, system, 'dart-mips') | 568 return os.path.join(dart_binary_prefix, system, 'dart-mips') |
562 else: | 569 else: |
563 return os.path.join(dart_binary_prefix, system, 'dart') | 570 return os.path.join(dart_binary_prefix, system, 'dart') |
564 | 571 |
565 | 572 |
566 def DartSdkBinary(): | 573 def DartSdkBinary(): |
(...skipping 23 matching lines...) Expand all Loading... |
590 os.chdir(self._working_directory) | 597 os.chdir(self._working_directory) |
591 | 598 |
592 def __exit__(self, *_): | 599 def __exit__(self, *_): |
593 print "Enter directory = ", self._old_cwd | 600 print "Enter directory = ", self._old_cwd |
594 os.chdir(self._old_cwd) | 601 os.chdir(self._old_cwd) |
595 | 602 |
596 | 603 |
597 if __name__ == "__main__": | 604 if __name__ == "__main__": |
598 import sys | 605 import sys |
599 Main() | 606 Main() |
OLD | NEW |