OLD | NEW |
| (Empty) |
1 #!/usr/bin/env python | |
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 | |
4 # BSD-style license that can be found in the LICENSE file. | |
5 | |
6 import imp | |
7 import os | |
8 import sys | |
9 | |
10 def main(args): | |
11 home = os.path.join(HOME, 'frog.py') | |
12 | |
13 if not os.path.exists(home): | |
14 print "Could not find %s" % home | |
15 return 1 | |
16 | |
17 frog_args = [ 'frog.py', '--vm=%s' % VM] | |
18 js_cmd_flag = '--js_cmd=%s --crankshaft' % D8 | |
19 vm_flags = None | |
20 for arg in args: | |
21 if arg.startswith('--js_cmd'): | |
22 js_cmd_flag = arg | |
23 if arg.startswith('--vm_flags'): | |
24 vm_flags = arg | |
25 if js_cmd_flag in args: | |
26 args.remove(js_cmd_flag) | |
27 if vm_flags in args: | |
28 args.remove(vm_flags) | |
29 frog_args.append(js_cmd_flag) | |
30 if vm_flags: | |
31 frog_args.append(vm_flags) | |
32 frog_args.append('--') | |
33 frog_args.extend(args[1:]) | |
34 | |
35 filename = None | |
36 exit_code = 1 | |
37 try: | |
38 # Load frog.py and invoke it. | |
39 paths = [os.path.dirname(home)] | |
40 (filename, pathname, description) = imp.find_module('frog', paths) | |
41 module = imp.load_module('frog', filename, pathname, description) | |
42 exit_code = module.main(frog_args) | |
43 finally: | |
44 if filename: | |
45 filename.close() | |
46 | |
47 return exit_code | |
OLD | NEW |