| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2011, 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 imp | 6 import imp |
| 7 import os | 7 import os |
| 8 import sys | 8 import sys |
| 9 | 9 |
| 10 def main(args): | 10 def main(args): |
| 11 # Try to find frog.py from the current location. | 11 # Try to find frog.py from the current location. |
| 12 home = os.path.join(os.curdir, 'frog.py') | 12 home = os.path.join(os.curdir, 'frog.py') |
| 13 if not os.path.exists(home): | 13 if not os.path.exists(home): |
| 14 home = os.path.join(os.curdir, 'frog', 'frog.py') | 14 home = os.path.join(os.curdir, 'frog', 'frog.py') |
| 15 | 15 |
| 16 if not os.path.exists(home): | 16 if not os.path.exists(home): |
| 17 print "Could not find frog" | 17 print "Could not find frog" |
| 18 return 1 | 18 return 1 |
| 19 | 19 |
| 20 frog_args = [ 'frog.py', '--vm=' + VM ] | 20 frog_args = [ 'frog.py', '--vm=%s' % VM] |
| 21 js_cmd_flag = '--js_cmd=%s --crankshaft' % D8 |
| 22 for arg in args: |
| 23 if arg.startswith('--js_cmd'): |
| 24 js_cmd_flag = arg |
| 25 if js_cmd_flag in args: |
| 26 args.remove(js_cmd_flag) |
| 27 frog_args.append(js_cmd_flag) |
| 21 if VM_FLAGS: | 28 if VM_FLAGS: |
| 22 frog_args.append(VM_FLAGS) | 29 frog_args.append(VM_FLAGS) |
| 23 frog_args.append('--') | 30 frog_args.append('--') |
| 24 frog_args.extend(args[1:]) | 31 frog_args.extend(args[1:]) |
| 25 | 32 |
| 26 filename = None | 33 filename = None |
| 27 exit_code = 1 | 34 exit_code = 1 |
| 28 try: | 35 try: |
| 29 # Load frog.py and invoke it. | 36 # Load frog.py and invoke it. |
| 30 paths = [os.path.dirname(home)] | 37 paths = [os.path.dirname(home)] |
| 31 (filename, pathname, description) = imp.find_module('frog', paths) | 38 (filename, pathname, description) = imp.find_module('frog', paths) |
| 32 module = imp.load_module('frog', filename, pathname, description) | 39 module = imp.load_module('frog', filename, pathname, description) |
| 33 exit_code = module.main(frog_args) | 40 exit_code = module.main(frog_args) |
| 34 finally: | 41 finally: |
| 35 if filename: | 42 if filename: |
| 36 filename.close() | 43 filename.close() |
| 37 | 44 |
| 38 return exit_code | 45 return exit_code |
| OLD | NEW |