| 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('mips'): |
| 54 return 'mips' |
| 53 elif (not id) or (not re.match('(x|i[3-6])86', id) is None): | 55 elif (not id) or (not re.match('(x|i[3-6])86', id) is None): |
| 54 return 'ia32' | 56 return 'ia32' |
| 55 elif id == 'i86pc': | 57 elif id == 'i86pc': |
| 56 return 'ia32' | 58 return 'ia32' |
| 57 elif '64' in id: | 59 elif '64' in id: |
| 58 return 'x64' | 60 return 'x64' |
| 59 else: | 61 else: |
| 60 return None | 62 return None |
| 61 | 63 |
| 62 | 64 |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 def DartBinary(): | 498 def DartBinary(): |
| 497 tools_dir = os.path.dirname(os.path.realpath(__file__)) | 499 tools_dir = os.path.dirname(os.path.realpath(__file__)) |
| 498 dart_binary_prefix = os.path.join(tools_dir, 'testing', 'bin') | 500 dart_binary_prefix = os.path.join(tools_dir, 'testing', 'bin') |
| 499 if IsWindows(): | 501 if IsWindows(): |
| 500 return os.path.join(dart_binary_prefix, 'windows', 'dart.exe') | 502 return os.path.join(dart_binary_prefix, 'windows', 'dart.exe') |
| 501 else: | 503 else: |
| 502 arch = GuessArchitecture() | 504 arch = GuessArchitecture() |
| 503 system = GuessOS() | 505 system = GuessOS() |
| 504 if arch == 'arm': | 506 if arch == 'arm': |
| 505 return os.path.join(dart_binary_prefix, system, 'dart-arm') | 507 return os.path.join(dart_binary_prefix, system, 'dart-arm') |
| 508 elif arch == 'mips': |
| 509 return os.path.join(dart_binary_prefix, system, 'dart-mips') |
| 506 else: | 510 else: |
| 507 return os.path.join(dart_binary_prefix, system, 'dart') | 511 return os.path.join(dart_binary_prefix, system, 'dart') |
| 508 | 512 |
| 509 | 513 |
| 510 def DartSdkBinary(): | 514 def DartSdkBinary(): |
| 511 tools_dir = os.path.dirname(os.path.realpath(__file__)) | 515 tools_dir = os.path.dirname(os.path.realpath(__file__)) |
| 512 dart_binary_prefix = os.path.join(tools_dir, '..', 'sdk' , 'bin') | 516 dart_binary_prefix = os.path.join(tools_dir, '..', 'sdk' , 'bin') |
| 513 return os.path.join(dart_binary_prefix, 'dart') | 517 return os.path.join(dart_binary_prefix, 'dart') |
| 514 | 518 |
| 515 class TempDir(object): | 519 class TempDir(object): |
| (...skipping 18 matching lines...) Expand all Loading... |
| 534 os.chdir(self._working_directory) | 538 os.chdir(self._working_directory) |
| 535 | 539 |
| 536 def __exit__(self, *_): | 540 def __exit__(self, *_): |
| 537 print "Enter directory = ", self._old_cwd | 541 print "Enter directory = ", self._old_cwd |
| 538 os.chdir(self._old_cwd) | 542 os.chdir(self._old_cwd) |
| 539 | 543 |
| 540 | 544 |
| 541 if __name__ == "__main__": | 545 if __name__ == "__main__": |
| 542 import sys | 546 import sys |
| 543 Main(sys.argv) | 547 Main(sys.argv) |
| OLD | NEW |