| 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 |
| 11 import sys | 11 import sys |
| 12 | 12 |
| 13 SCRIPT_DIR = os.path.dirname(sys.argv[0]) | 13 SCRIPT_DIR = os.path.dirname(sys.argv[0]) |
| 14 DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..')) | 14 DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..')) |
| 15 PUB_PATH = os.path.join(DART_ROOT, 'sdk/lib/_internal/pub/bin/pub.dart') | 15 PUB_PATH = os.path.join(DART_ROOT, |
| 16 'sdk/lib/_internal/pub_generated/bin/pub.dart') |
| 16 CANARY_PATH = os.path.join(DART_ROOT, 'tools', 'canary.dart') | 17 CANARY_PATH = os.path.join(DART_ROOT, 'tools', 'canary.dart') |
| 17 | 18 |
| 18 usage = """run_pub.py --package-root=<package root>""" | 19 usage = """run_pub.py --package-root=<package root>""" |
| 19 | 20 |
| 20 def BuildArguments(): | 21 def BuildArguments(): |
| 21 result = argparse.ArgumentParser(usage=usage) | 22 result = argparse.ArgumentParser(usage=usage) |
| 22 result.add_argument("--package-root", help="package root", default=None) | 23 result.add_argument("--package-root", help="package root", default=None) |
| 23 result.add_argument("--dart-executable", help="dart binary", default=None) | 24 result.add_argument("--dart-executable", help="dart binary", default=None) |
| 24 return result | 25 return result |
| 25 | 26 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 (options, args) = parser.parse_known_args() | 95 (options, args) = parser.parse_known_args() |
| 95 if not ProcessOptions(options, args): | 96 if not ProcessOptions(options, args): |
| 96 parser.print_help() | 97 parser.print_help() |
| 97 return 1 | 98 return 1 |
| 98 dart_executable = FindDartExecutable(options.dart_executable, | 99 dart_executable = FindDartExecutable(options.dart_executable, |
| 99 options.package_root) | 100 options.package_root) |
| 100 return RunPub(dart_executable, options.package_root, args) | 101 return RunPub(dart_executable, options.package_root, args) |
| 101 | 102 |
| 102 | 103 |
| 103 if __name__ == '__main__': | 104 if __name__ == '__main__': |
| 104 sys.exit(main()) | 105 sys.exit(main()); |
| OLD | NEW |