| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """The frontend for the Mojo bindings system.""" | 6 """The frontend for the Mojo bindings system.""" |
| 7 | 7 |
| 8 | 8 |
| 9 import argparse | 9 import argparse |
| 10 import imp | 10 import imp |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 190 |
| 191 if rel_filename.path in imported_filename_stack: | 191 if rel_filename.path in imported_filename_stack: |
| 192 print "%s: Error: Circular dependency" % rel_filename.path + \ | 192 print "%s: Error: Circular dependency" % rel_filename.path + \ |
| 193 MakeImportStackMessage(imported_filename_stack + [rel_filename.path]) | 193 MakeImportStackMessage(imported_filename_stack + [rel_filename.path]) |
| 194 sys.exit(1) | 194 sys.exit(1) |
| 195 | 195 |
| 196 try: | 196 try: |
| 197 with open(rel_filename.path) as f: | 197 with open(rel_filename.path) as f: |
| 198 source = f.read() | 198 source = f.read() |
| 199 except IOError as e: | 199 except IOError as e: |
| 200 print "%s: Error: %s" % (e.rel_filename.path, e.strerror) + \ | 200 print "%s: Error: %s" % (rel_filename.path, e.strerror) + \ |
| 201 MakeImportStackMessage(imported_filename_stack + [rel_filename.path]) | 201 MakeImportStackMessage(imported_filename_stack + [rel_filename.path]) |
| 202 sys.exit(1) | 202 sys.exit(1) |
| 203 | 203 |
| 204 try: | 204 try: |
| 205 tree = Parse(source, rel_filename.path) | 205 tree = Parse(source, rel_filename.path) |
| 206 except Error as e: | 206 except Error as e: |
| 207 full_stack = imported_filename_stack + [rel_filename.path] | 207 full_stack = imported_filename_stack + [rel_filename.path] |
| 208 print str(e) + MakeImportStackMessage(full_stack) | 208 print str(e) + MakeImportStackMessage(full_stack) |
| 209 sys.exit(1) | 209 sys.exit(1) |
| 210 | 210 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 "-o", "--output_dir", dest="output_dir", default=".", | 315 "-o", "--output_dir", dest="output_dir", default=".", |
| 316 help="output directory for precompiled templates") | 316 help="output directory for precompiled templates") |
| 317 precompile_parser.set_defaults(func=_Precompile) | 317 precompile_parser.set_defaults(func=_Precompile) |
| 318 | 318 |
| 319 args, remaining_args = parser.parse_known_args() | 319 args, remaining_args = parser.parse_known_args() |
| 320 return args.func(args, remaining_args) | 320 return args.func(args, remaining_args) |
| 321 | 321 |
| 322 | 322 |
| 323 if __name__ == "__main__": | 323 if __name__ == "__main__": |
| 324 sys.exit(main()) | 324 sys.exit(main()) |
| OLD | NEW |