paul@0 | 1 | #!/usr/bin/env python |
paul@0 | 2 | |
paul@0 | 3 | import micropython |
paul@0 | 4 | import sys |
paul@4 | 5 | |
paul@55 | 6 | def show(importer, with_builtins=0): |
paul@55 | 7 | for i, x in enumerate(importer.get_image(with_builtins=with_builtins)): |
paul@22 | 8 | print i, x |
paul@22 | 9 | |
paul@52 | 10 | def attrs(obj): |
paul@52 | 11 | for name, attr in obj.items(): |
paul@52 | 12 | print name, attr |
paul@52 | 13 | |
paul@35 | 14 | i = micropython.Importer(sys.path, "-v" in sys.argv) |
paul@37 | 15 | try: |
paul@61 | 16 | builtins = i.load_from_file("lib/builtins.py", "__builtins__") |
paul@37 | 17 | if len(sys.argv) < 2: |
paul@37 | 18 | m = i.load("micropython") |
paul@37 | 19 | #m = i.load_from_file("micropython/__init__.py") |
paul@37 | 20 | else: |
paul@37 | 21 | m = i.load_from_file(sys.argv[1]) |
paul@39 | 22 | except micropython.ProcessingError, exc: |
paul@39 | 23 | print repr(exc) |
paul@4 | 24 | else: |
paul@37 | 25 | i.vacuum() |
paul@37 | 26 | ot = i.get_object_table() |
paul@37 | 27 | pt = i.get_parameter_table() |
paul@0 | 28 | |
paul@0 | 29 | # vim: tabstop=4 expandtab shiftwidth=4 |