OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2016, 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 | 5 |
6 import argparse | 6 import argparse |
7 import os | 7 import os |
8 import subprocess | 8 import subprocess |
9 import sys | 9 import sys |
10 import utils | 10 import utils |
11 | 11 |
12 usage = """patch_sdk.py [options]""" | 12 usage = """patch_sdk.py [options]""" |
13 | 13 |
| 14 def DisplayBootstrapWarning(): |
| 15 print """\ |
| 16 |
| 17 |
| 18 WARNING: Your system cannot run the checked-in Dart SDK. Using the |
| 19 bootstrap Dart executable will make debug builds slow. |
| 20 Please see the Wiki for instructions on replacing the checked-in Dart SDK. |
| 21 |
| 22 https://github.com/dart-lang/sdk/wiki/The-checked-in-SDK-in-tools |
| 23 |
| 24 """ |
| 25 |
14 def BuildArguments(): | 26 def BuildArguments(): |
15 result = argparse.ArgumentParser(usage=usage) | 27 result = argparse.ArgumentParser(usage=usage) |
16 result.add_argument("--dart-executable", help="dart executable", default=None) | 28 result.add_argument("--dart-executable", help="dart executable", default=None) |
17 return result | 29 return result |
18 | 30 |
19 def main(): | 31 def main(): |
20 # Parse the options. | 32 # Parse the options. |
21 parser = BuildArguments() | 33 parser = BuildArguments() |
22 (options, args) = parser.parse_known_args() | 34 (options, args) = parser.parse_known_args() |
23 if options.dart_executable is not None: | 35 if utils.CheckedInSdkCheckExecutable(): |
| 36 options.dart_executable = utils.CheckedInSdkExecutable() |
| 37 elif options.dart_executable is not None: |
| 38 DisplayBootstrapWarning() |
24 options.dart_executable = os.path.abspath(options.dart_executable) | 39 options.dart_executable = os.path.abspath(options.dart_executable) |
25 else: | 40 else: |
26 options.dart_executable = os.path.join(utils.CheckedInSdkPath(), 'bin', 'dar
t') | 41 print >> sys.stderr, 'ERROR: cannot locate dart executable' |
| 42 return -1 |
27 dart_file = os.path.join(os.path.dirname(__file__), 'patch_sdk.dart') | 43 dart_file = os.path.join(os.path.dirname(__file__), 'patch_sdk.dart') |
28 subprocess.check_call([options.dart_executable, dart_file] + args); | 44 subprocess.check_call([options.dart_executable, dart_file] + args) |
| 45 return 0 |
29 | 46 |
30 if __name__ == '__main__': | 47 if __name__ == '__main__': |
31 main() | 48 sys.exit(main()) |
OLD | NEW |