| 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 home = os.path.join(HOME, 'frog.py') |
| 12 home = os.path.join(os.curdir, 'frog.py') | |
| 13 if not os.path.exists(home): | |
| 14 home = os.path.join(os.curdir, 'frog', 'frog.py') | |
| 15 | 12 |
| 16 if not os.path.exists(home): | 13 if not os.path.exists(home): |
| 17 print "Could not find frog" | 14 print "Could not find %s" % home |
| 18 return 1 | 15 return 1 |
| 19 | 16 |
| 20 frog_args = [ 'frog.py', '--vm=%s' % VM] | 17 frog_args = [ 'frog.py', '--vm=%s' % VM] |
| 21 js_cmd_flag = '--js_cmd=%s --crankshaft' % D8 | 18 js_cmd_flag = '--js_cmd=%s --crankshaft' % D8 |
| 22 vm_flags = None | 19 vm_flags = None |
| 23 for arg in args: | 20 for arg in args: |
| 24 if arg.startswith('--js_cmd'): | 21 if arg.startswith('--js_cmd'): |
| 25 js_cmd_flag = arg | 22 js_cmd_flag = arg |
| 26 if arg.startswith('--vm_flags'): | 23 if arg.startswith('--vm_flags'): |
| 27 vm_flags = arg | 24 vm_flags = arg |
| (...skipping 13 matching lines...) Expand all Loading... |
| 41 # Load frog.py and invoke it. | 38 # Load frog.py and invoke it. |
| 42 paths = [os.path.dirname(home)] | 39 paths = [os.path.dirname(home)] |
| 43 (filename, pathname, description) = imp.find_module('frog', paths) | 40 (filename, pathname, description) = imp.find_module('frog', paths) |
| 44 module = imp.load_module('frog', filename, pathname, description) | 41 module = imp.load_module('frog', filename, pathname, description) |
| 45 exit_code = module.main(frog_args) | 42 exit_code = module.main(frog_args) |
| 46 finally: | 43 finally: |
| 47 if filename: | 44 if filename: |
| 48 filename.close() | 45 filename.close() |
| 49 | 46 |
| 50 return exit_code | 47 return exit_code |
| OLD | NEW |