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

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') | no next file with comments »
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 result = 0 206 result = 0
206 if not outfile_given: 207 if not outfile_given:
207 if not options.html: 208 if not options.html:
208 js_cmd = options.js_cmd 209 js_cmd = options.js_cmd
209 result = execute(js_cmd.split(' ') + [outfile] + nodeArgs) 210 result = execute(js_cmd.split(' ') + [outfile] + nodeArgs)
210 else: 211 else:
211 f = open(outhtml, 'w') 212 f = open(outhtml, 'w')
212 f.write(HTML) 213 f.write(HTML)
213 f.close() 214 f.close()
214 result = execute([browser, outhtml]) 215 result = execute([browser, outhtml])
216 else:
217 print 'Compilation succeded. Code generated in: %s' % outfile
215 218
216 if cleanup: shutil.rmtree(workdir) 219 if cleanup: shutil.rmtree(workdir)
217 if result != 0: 220 if result != 0:
218 return 1 221 return 1
219 return 0 222 return 0
220 223
221 if __name__ == '__main__': 224 if __name__ == '__main__':
222 sys.exit(main(sys.argv)) 225 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | frog/frog_options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698