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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 elif arch == 'arm': | 627 elif arch == 'arm': |
628 name = 'dart-arm' | 628 name = 'dart-arm' |
629 return os.path.join(CheckedInSdkPath(), 'bin', name) | 629 return os.path.join(CheckedInSdkPath(), 'bin', name) |
630 | 630 |
631 | 631 |
632 def CheckedInSdkCheckExecutable(): | 632 def CheckedInSdkCheckExecutable(): |
633 executable = CheckedInSdkExecutable() | 633 executable = CheckedInSdkExecutable() |
634 canary_script = os.path.join(os.path.dirname(os.path.realpath(__file__)), | 634 canary_script = os.path.join(os.path.dirname(os.path.realpath(__file__)), |
635 'canary.dart') | 635 'canary.dart') |
636 try: | 636 try: |
637 if 42 == subprocess.call([executable, canary_script]): | 637 with open(os.devnull, 'wb') as silent_sink: |
638 return True | 638 if 0 == subprocess.call([executable, canary_script], stdout=silent_sink): |
| 639 return True |
639 except OSError as e: | 640 except OSError as e: |
640 pass | 641 pass |
641 return False | 642 return False |
642 | 643 |
643 | 644 |
644 class TempDir(object): | 645 class TempDir(object): |
645 def __init__(self, prefix=''): | 646 def __init__(self, prefix=''): |
646 self._temp_dir = None | 647 self._temp_dir = None |
647 self._prefix = prefix | 648 self._prefix = prefix |
648 | 649 |
(...skipping 14 matching lines...) Expand all Loading... |
663 os.chdir(self._working_directory) | 664 os.chdir(self._working_directory) |
664 | 665 |
665 def __exit__(self, *_): | 666 def __exit__(self, *_): |
666 print "Enter directory = ", self._old_cwd | 667 print "Enter directory = ", self._old_cwd |
667 os.chdir(self._old_cwd) | 668 os.chdir(self._old_cwd) |
668 | 669 |
669 | 670 |
670 if __name__ == "__main__": | 671 if __name__ == "__main__": |
671 import sys | 672 import sys |
672 Main() | 673 Main() |
OLD | NEW |