| 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 # Note: can't use super calls because HTMLParser is not a subclass of object | 363 # Note: can't use super calls because HTMLParser is not a subclass of object |
| 364 DartHTMLConverter.__init__(self, None, prefix_path) | 364 DartHTMLConverter.__init__(self, None, prefix_path) |
| 365 self.outdir = outdir | 365 self.outdir = outdir |
| 366 self.verbose = verbose | 366 self.verbose = verbose |
| 367 | 367 |
| 368 def compileScript(self, attrDic): | 368 def compileScript(self, attrDic): |
| 369 self.contains_dart = True | 369 self.contains_dart = True |
| 370 if 'src' in attrDic: | 370 if 'src' in attrDic: |
| 371 status, out, err = execute([ | 371 status, out, err = execute([ |
| 372 sys.executable, | 372 sys.executable, |
| 373 join(CLIENT_PATH, 'tools', 'copy_dart.py'), | 373 join(DART_PATH, 'tools', 'copy_dart.py'), |
| 374 self.outdir, | 374 self.outdir, |
| 375 convertPath(attrDic['src'], self.prefix_path)], | 375 convertPath(attrDic['src'], self.prefix_path)], |
| 376 self.verbose) | 376 self.verbose) |
| 377 | 377 |
| 378 if status: | 378 if status: |
| 379 raise ConverterException('exception calling copy_dart.py') | 379 raise ConverterException('exception calling copy_dart.py') |
| 380 | 380 |
| 381 # do not rewrite the script tag | 381 # do not rewrite the script tag |
| 382 return False | 382 return False |
| 383 | 383 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 if 'dartium' in options.target: | 566 if 'dartium' in options.target: |
| 567 convertForDartium(filename, options.out, | 567 convertForDartium(filename, options.out, |
| 568 outfile.replace(extension, '-dart' + extension), options.verbose) | 568 outfile.replace(extension, '-dart' + extension), options.verbose) |
| 569 except Exception as e: | 569 except Exception as e: |
| 570 print "%sERROR%s: %s" % (RED_COLOR, NO_COLOR, str(e)) | 570 print "%sERROR%s: %s" % (RED_COLOR, NO_COLOR, str(e)) |
| 571 return 1 | 571 return 1 |
| 572 return 0 | 572 return 0 |
| 573 | 573 |
| 574 if __name__ == '__main__': | 574 if __name__ == '__main__': |
| 575 sys.exit(main()) | 575 sys.exit(main()) |
| OLD | NEW |