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 """Command line wrapper to run the frog compiler under the Dart VM""" | 6 """Command line wrapper to run the frog compiler under the Dart VM""" |
7 | 7 |
8 # TODO(jimhug): This is a temporary hack to enable running on the VM. We need | 8 # TODO(jimhug): This is a temporary hack to enable running on the VM. We need |
9 # the ability to get command-line arguments, to return exit codes, and to | 9 # the ability to get command-line arguments, to return exit codes, and to |
10 # communicate with spawned processes in the VM for this to go away. | 10 # communicate with spawned processes in the VM for this to go away. |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 browser = 'Open' | 191 browser = 'Open' |
192 else: | 192 else: |
193 # TODO(vsm): This is only available on Goobuntu. | 193 # TODO(vsm): This is only available on Goobuntu. |
194 browser = 'google-chrome' | 194 browser = 'google-chrome' |
195 | 195 |
196 args = ['--libdir=%s/lib' % HOME] + args | 196 args = ['--libdir=%s/lib' % HOME] + args |
197 | 197 |
198 compiler_cmd = [dart] | 198 compiler_cmd = [dart] |
199 if options.vm_flags: | 199 if options.vm_flags: |
200 compiler_cmd.extend(options.vm_flags.split(' ')) | 200 compiler_cmd.extend(options.vm_flags.split(' ')) |
201 compiler_cmd.append('frogc.dart'); | 201 compiler_cmd.append(join(HOME, 'frogc.dart')) |
Siggi Cherem (dart-lang)
2011/11/11 01:25:51
this allows running test.py from the top-level dir
| |
202 compiler_cmd.extend(args) | 202 compiler_cmd.extend(args) |
203 exit_code = execute(compiler_cmd) | 203 exit_code = execute(compiler_cmd) |
204 if exit_code: | 204 if exit_code: |
205 if options.verbose: print ("cmd exited with status %d" % exit_code) | 205 if options.verbose: print ("cmd exited with status %d" % exit_code) |
206 if cleanup: shutil.rmtree(workdir) | 206 if cleanup: shutil.rmtree(workdir) |
207 if exit_code < 0: | 207 if exit_code < 0: |
208 print("VM exited with signal %d" % (-exit_code)) | 208 print("VM exited with signal %d" % (-exit_code)) |
209 return exit_code | 209 return exit_code |
210 | 210 |
211 result = 0 | 211 result = 0 |
212 if not outfile_given: | 212 if not outfile_given: |
213 if not options.html: | 213 if not options.html: |
214 js_cmd = options.js_cmd | 214 js_cmd = options.js_cmd |
215 result = execute(js_cmd.split(' ') + [outfile] + nodeArgs) | 215 result = execute(js_cmd.split(' ') + [outfile] + nodeArgs) |
216 else: | 216 else: |
217 f = open(outhtml, 'w') | 217 f = open(outhtml, 'w') |
218 f.write(HTML) | 218 f.write(HTML) |
219 f.close() | 219 f.close() |
220 result = execute([browser, outhtml]) | 220 result = execute([browser, outhtml]) |
221 | 221 |
222 if cleanup: shutil.rmtree(workdir) | 222 if cleanup: shutil.rmtree(workdir) |
223 if result != 0: | 223 if result != 0: |
224 return 1 | 224 return 1 |
225 return 0 | 225 return 0 |
226 | 226 |
227 if __name__ == '__main__': | 227 if __name__ == '__main__': |
228 sys.exit(main(sys.argv)) | 228 sys.exit(main(sys.argv)) |
OLD | NEW |