OLD | NEW |
1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 # for details. All rights reserved. Use of this source code is governed by a | 2 # for details. All rights reserved. Use of this source code is governed by a |
3 # BSD-style license that can be found in the LICENSE file. | 3 # BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #!/usr/bin/env python | 5 #!/usr/bin/env python |
6 # | 6 # |
7 | 7 |
8 """Rewrites HTML files, converting Dart script sections into JavaScript. | 8 """Rewrites HTML files, converting Dart script sections into JavaScript. |
9 | 9 |
10 Process HTML files, and internally changes script sections that use Dart code | 10 Process HTML files, and internally changes script sections that use Dart code |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 # Cleanup | 153 # Cleanup |
154 if indir is not None: | 154 if indir is not None: |
155 shutil.rmtree(indir) | 155 shutil.rmtree(indir) |
156 shutil.rmtree(outdir) | 156 shutil.rmtree(outdir) |
157 return CHROMIUM_SCRIPT_TEMPLATE % res | 157 return CHROMIUM_SCRIPT_TEMPLATE % res |
158 | 158 |
159 def compileCommand(self, inputfile, outdir): | 159 def compileCommand(self, inputfile, outdir): |
160 binary = abspath(join(DART_PATH, | 160 binary = abspath(join(DART_PATH, |
161 utils.GetBuildRoot(utils.GuessOS(), | 161 utils.GetBuildRoot(utils.GuessOS(), |
162 'release', 'ia32'), | 162 'release', 'ia32'), |
163 'frog', 'bin', 'frogsh')) | 163 'frog', 'bin', 'frog')) |
164 if not exists(binary): | 164 if not exists(binary): |
165 raise ConverterException(FROG_NOT_FOUND_ERROR % DART_PATH) | 165 raise ConverterException(FROG_NOT_FOUND_ERROR % DART_PATH) |
166 | 166 |
167 cmd = [binary, '--compile-only', | 167 cmd = [binary, '--compile-only', |
168 '--libdir=' + join(DART_PATH, 'frog', 'lib'), | 168 '--libdir=' + join(DART_PATH, 'frog', 'lib'), |
169 '--out=' + self.outputFileName(inputfile, outdir)] | 169 '--out=' + self.outputFileName(inputfile, outdir)] |
170 if self.extra_flags != "": | 170 if self.extra_flags != "": |
171 cmd.append(self.extra_flags); | 171 cmd.append(self.extra_flags); |
172 cmd.append(inputfile) | 172 cmd.append(inputfile) |
173 return cmd | 173 return cmd |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 if 'dartium' in options.target: | 549 if 'dartium' in options.target: |
550 convertForDartium(filename, options.out, | 550 convertForDartium(filename, options.out, |
551 outfile.replace(extension, '-dart' + extension), options.verbose) | 551 outfile.replace(extension, '-dart' + extension), options.verbose) |
552 except Exception as e: | 552 except Exception as e: |
553 print "%sERROR%s: %s" % (RED_COLOR, NO_COLOR, str(e)) | 553 print "%sERROR%s: %s" % (RED_COLOR, NO_COLOR, str(e)) |
554 return 1 | 554 return 1 |
555 return 0 | 555 return 0 |
556 | 556 |
557 if __name__ == '__main__': | 557 if __name__ == '__main__': |
558 sys.exit(main()) | 558 sys.exit(main()) |
OLD | NEW |