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 os | 7 import os |
7 import subprocess | 8 import subprocess |
8 import sys | 9 import sys |
9 import utils | 10 import utils |
10 | 11 |
| 12 usage = """patch_sdk.py [options]""" |
| 13 |
| 14 def BuildArguments(): |
| 15 result = argparse.ArgumentParser(usage=usage) |
| 16 result.add_argument("--dart-executable", help="dart executable", default=None) |
| 17 return result |
| 18 |
11 def main(): | 19 def main(): |
12 dart = os.path.join(utils.CheckedInSdkPath(), 'bin', 'dart') | 20 # Parse the options. |
| 21 parser = BuildArguments() |
| 22 (options, args) = parser.parse_known_args() |
| 23 if options.dart_executable is not None: |
| 24 options.dart_executable = os.path.abspath(options.dart_executable) |
| 25 else: |
| 26 options.dart_executable = os.path.join(utils.CheckedInSdkPath(), 'bin', 'dar
t') |
13 dart_file = os.path.join(os.path.dirname(__file__), 'patch_sdk.dart') | 27 dart_file = os.path.join(os.path.dirname(__file__), 'patch_sdk.dart') |
14 subprocess.check_call([dart, dart_file] + sys.argv[1:]); | 28 subprocess.check_call([options.dart_executable, dart_file] + args); |
15 | 29 |
16 if __name__ == '__main__': | 30 if __name__ == '__main__': |
17 main() | 31 main() |
OLD | NEW |