| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
| 4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
| 5 """Used to run pub before the SDK has been built""" | 5 """Used to run pub before the SDK has been built""" |
| 6 | 6 |
| 7 import argparse | 7 import argparse |
| 8 import os | 8 import os |
| 9 import platform | 9 import platform |
| 10 import subprocess | 10 import subprocess |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 result.add_argument("--dart-executable", help="dart binary", default=None) | 24 result.add_argument("--dart-executable", help="dart binary", default=None) |
| 25 return result | 25 return result |
| 26 | 26 |
| 27 def ProcessOptions(options, args): | 27 def ProcessOptions(options, args): |
| 28 return ((options.package_root != None) and | 28 return ((options.package_root != None) and |
| 29 (options.dart_executable != None)) | 29 (options.dart_executable != None)) |
| 30 | 30 |
| 31 def GetPrebuiltDartExecutablePath(): | 31 def GetPrebuiltDartExecutablePath(): |
| 32 osdict = {'Darwin':'macos', 'Linux':'linux', 'Windows':'win32'} | 32 osdict = {'Darwin':'macos', 'Linux':'linux', 'Windows':'win32'} |
| 33 system = platform.system() | 33 system = platform.system() |
| 34 executable_name = 'dart' |
| 35 if system == 'Windows': |
| 36 executable_name = 'dart.exe' |
| 34 try: | 37 try: |
| 35 osname = osdict[system] | 38 osname = osdict[system] |
| 36 except KeyError: | 39 except KeyError: |
| 37 print >>sys.stderr, ('WARNING: platform "%s" not supported') % (system) | 40 print >>sys.stderr, ('WARNING: platform "%s" not supported') % (system) |
| 38 return None; | 41 return None; |
| 39 return os.path.join(DART_ROOT, 'tools', 'testing', 'bin', osname, 'dart') | 42 return os.path.join(DART_ROOT, |
| 43 'tools', |
| 44 'testing', |
| 45 'bin', |
| 46 osname, |
| 47 executable_name) |
| 40 | 48 |
| 41 def RunPub(dart, pkg_root, args): | 49 def RunPub(dart, pkg_root, args): |
| 42 return subprocess.call([dart, '--package-root=' + pkg_root, PUB_PATH] + args) | 50 return subprocess.call([dart, '--package-root=' + pkg_root, PUB_PATH] + args) |
| 43 | 51 |
| 44 def TryRunningExecutable(dart_executable, pkg_root): | 52 def TryRunningExecutable(dart_executable, pkg_root): |
| 45 return subprocess.call([dart_executable, | 53 return subprocess.call([dart_executable, |
| 46 '--package-root=' + pkg_root, | 54 '--package-root=' + pkg_root, |
| 47 CANARY_PATH]) == 42 | 55 CANARY_PATH]) == 42 |
| 48 | 56 |
| 49 def DisplayBootstrapWarning(): | 57 def DisplayBootstrapWarning(): |
| (...skipping 23 matching lines...) Expand all Loading... |
| 73 dart_executable = options.dart_executable | 81 dart_executable = options.dart_executable |
| 74 # If requested, use the bootstrap binary instead of the prebuilt | 82 # If requested, use the bootstrap binary instead of the prebuilt |
| 75 # executable. | 83 # executable. |
| 76 if os.getenv('DART_USE_BOOTSTRAP_BIN') != None: | 84 if os.getenv('DART_USE_BOOTSTRAP_BIN') != None: |
| 77 dart_executable = options.dart_executable | 85 dart_executable = options.dart_executable |
| 78 return RunPub(dart_executable, options.package_root, args) | 86 return RunPub(dart_executable, options.package_root, args) |
| 79 | 87 |
| 80 | 88 |
| 81 if __name__ == '__main__': | 89 if __name__ == '__main__': |
| 82 sys.exit(main()); | 90 sys.exit(main()); |
| OLD | NEW |