| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 id = platform.machine() | 50 id = platform.machine() |
| 51 if id.startswith('arm'): | 51 if id.startswith('arm'): |
| 52 return 'arm' | 52 return 'arm' |
| 53 elif id.startswith('aarch64'): |
| 54 return 'arm64' |
| 53 elif id.startswith('mips'): | 55 elif id.startswith('mips'): |
| 54 return 'mips' | 56 return 'mips' |
| 55 elif (not id) or (not re.match('(x|i[3-6])86', id) is None): | 57 elif (not id) or (not re.match('(x|i[3-6])86', id) is None): |
| 56 return 'ia32' | 58 return 'ia32' |
| 57 elif id == 'i86pc': | 59 elif id == 'i86pc': |
| 58 return 'ia32' | 60 return 'ia32' |
| 59 elif '64' in id: | 61 elif '64' in id: |
| 60 return 'x64' | 62 return 'x64' |
| 61 else: | 63 else: |
| 62 guess_os = GuessOS() | 64 guess_os = GuessOS() |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 def DartBinary(): | 523 def DartBinary(): |
| 522 tools_dir = os.path.dirname(os.path.realpath(__file__)) | 524 tools_dir = os.path.dirname(os.path.realpath(__file__)) |
| 523 dart_binary_prefix = os.path.join(tools_dir, 'testing', 'bin') | 525 dart_binary_prefix = os.path.join(tools_dir, 'testing', 'bin') |
| 524 if IsWindows(): | 526 if IsWindows(): |
| 525 return os.path.join(dart_binary_prefix, 'windows', 'dart.exe') | 527 return os.path.join(dart_binary_prefix, 'windows', 'dart.exe') |
| 526 else: | 528 else: |
| 527 arch = GuessArchitecture() | 529 arch = GuessArchitecture() |
| 528 system = GuessOS() | 530 system = GuessOS() |
| 529 if arch == 'arm': | 531 if arch == 'arm': |
| 530 return os.path.join(dart_binary_prefix, system, 'dart-arm') | 532 return os.path.join(dart_binary_prefix, system, 'dart-arm') |
| 533 elif arch == 'arm64': |
| 534 return os.path.join(dart_binary_prefix, system, 'dart-arm64') |
| 531 elif arch == 'mips': | 535 elif arch == 'mips': |
| 532 return os.path.join(dart_binary_prefix, system, 'dart-mips') | 536 return os.path.join(dart_binary_prefix, system, 'dart-mips') |
| 533 else: | 537 else: |
| 534 return os.path.join(dart_binary_prefix, system, 'dart') | 538 return os.path.join(dart_binary_prefix, system, 'dart') |
| 535 | 539 |
| 536 | 540 |
| 537 def DartSdkBinary(): | 541 def DartSdkBinary(): |
| 538 tools_dir = os.path.dirname(os.path.realpath(__file__)) | 542 tools_dir = os.path.dirname(os.path.realpath(__file__)) |
| 539 dart_binary_prefix = os.path.join(tools_dir, '..', 'sdk' , 'bin') | 543 dart_binary_prefix = os.path.join(tools_dir, '..', 'sdk' , 'bin') |
| 540 return os.path.join(dart_binary_prefix, 'dart') | 544 return os.path.join(dart_binary_prefix, 'dart') |
| (...skipping 20 matching lines...) Expand all Loading... |
| 561 os.chdir(self._working_directory) | 565 os.chdir(self._working_directory) |
| 562 | 566 |
| 563 def __exit__(self, *_): | 567 def __exit__(self, *_): |
| 564 print "Enter directory = ", self._old_cwd | 568 print "Enter directory = ", self._old_cwd |
| 565 os.chdir(self._old_cwd) | 569 os.chdir(self._old_cwd) |
| 566 | 570 |
| 567 | 571 |
| 568 if __name__ == "__main__": | 572 if __name__ == "__main__": |
| 569 import sys | 573 import sys |
| 570 Main(sys.argv) | 574 Main(sys.argv) |
| OLD | NEW |