Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: frog/frog.py

Issue 8823010: frog: life is better with colors :) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: '' Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | frog/frog_options.dart » ('j') | frog/frog_options.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 for i in range(len(args)): 147 for i in range(len(args)):
148 if args[i].endswith('.dart'): 148 if args[i].endswith('.dart'):
149 nodeArgs = args[i+1:] 149 nodeArgs = args[i+1:]
150 args = args[:i+1] 150 args = args[:i+1]
151 break 151 break
152 152
153 outfile_given = False 153 outfile_given = False
154 for i in range(len(args)): 154 for i in range(len(args)):
155 if args[i].startswith('--out'): 155 if args[i].startswith('--out'):
156 outfile_given = True 156 outfile_given = True
157 outfile = args[i][6:]
157 break; 158 break;
158 159
159 if options.verbose: print "nodeArgs %s" % ' '.join(nodeArgs); 160 if options.verbose: print "nodeArgs %s" % ' '.join(nodeArgs);
160 161
161 workdir = options.workdir 162 workdir = options.workdir
162 cleanup = False 163 cleanup = False
163 if not workdir: 164 if not workdir:
164 if not options.html: 165 if not options.html:
165 workdir = tempfile.mkdtemp() 166 workdir = tempfile.mkdtemp()
166 if not options.keep_files: 167 if not options.keep_files:
(...skipping 30 matching lines...) Expand all
197 exit_code = execute(compiler_cmd) 198 exit_code = execute(compiler_cmd)
198 if exit_code: 199 if exit_code:
199 if options.verbose: print ("cmd exited with status %d" % exit_code) 200 if options.verbose: print ("cmd exited with status %d" % exit_code)
200 if cleanup: shutil.rmtree(workdir) 201 if cleanup: shutil.rmtree(workdir)
201 if exit_code < 0: 202 if exit_code < 0:
202 print("VM exited with signal %d" % (-exit_code)) 203 print("VM exited with signal %d" % (-exit_code))
203 return exit_code 204 return exit_code
204 205
205 result = 0 206 result = 0
206 if not outfile_given: 207 if not outfile_given:
208 print 'Compilation succeded.'
207 if not options.html: 209 if not options.html:
208 js_cmd = options.js_cmd 210 js_cmd = options.js_cmd
209 result = execute(js_cmd.split(' ') + [outfile] + nodeArgs) 211 result = execute(js_cmd.split(' ') + [outfile] + nodeArgs)
210 else: 212 else:
211 f = open(outhtml, 'w') 213 f = open(outhtml, 'w')
212 f.write(HTML) 214 f.write(HTML)
213 f.close() 215 f.close()
214 result = execute([browser, outhtml]) 216 result = execute([browser, outhtml])
217 else:
218 print 'Compilation succeded. Code generated in %s' % outfile
215 219
216 if cleanup: shutil.rmtree(workdir) 220 if cleanup: shutil.rmtree(workdir)
217 if result != 0: 221 if result != 0:
218 return 1 222 return 1
219 return 0 223 return 0
220 224
221 if __name__ == '__main__': 225 if __name__ == '__main__':
222 sys.exit(main(sys.argv)) 226 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | frog/frog_options.dart » ('j') | frog/frog_options.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698