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 11 matching lines...) Expand all Loading... |
22 result = argparse.ArgumentParser(usage=usage) | 22 result = argparse.ArgumentParser(usage=usage) |
23 result.add_argument("--package-root", help="package root", default=None) | 23 result.add_argument("--package-root", help="package root", default=None) |
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':'windows'} |
33 system = platform.system() | 33 system = platform.system() |
34 executable_name = 'dart' | 34 executable_name = 'dart' |
35 if system == 'Windows': | 35 if system == 'Windows': |
36 executable_name = 'dart.exe' | 36 executable_name = 'dart.exe' |
37 try: | 37 try: |
38 osname = osdict[system] | 38 osname = osdict[system] |
39 except KeyError: | 39 except KeyError: |
40 print >>sys.stderr, ('WARNING: platform "%s" not supported') % (system) | 40 print >>sys.stderr, ('WARNING: platform "%s" not supported') % (system) |
41 return None; | 41 return None; |
42 return os.path.join(DART_ROOT, | 42 return os.path.join(DART_ROOT, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 dart_executable = options.dart_executable | 81 dart_executable = options.dart_executable |
82 # If requested, use the bootstrap binary instead of the prebuilt | 82 # If requested, use the bootstrap binary instead of the prebuilt |
83 # executable. | 83 # executable. |
84 if os.getenv('DART_USE_BOOTSTRAP_BIN') != None: | 84 if os.getenv('DART_USE_BOOTSTRAP_BIN') != None: |
85 dart_executable = options.dart_executable | 85 dart_executable = options.dart_executable |
86 return RunPub(dart_executable, options.package_root, args) | 86 return RunPub(dart_executable, options.package_root, args) |
87 | 87 |
88 | 88 |
89 if __name__ == '__main__': | 89 if __name__ == '__main__': |
90 sys.exit(main()); | 90 sys.exit(main()); |
OLD | NEW |