Skip to content
Snippets Groups Projects
Select Git revision
  • fc6222fd60b2a0a612d5f8ec79e5ea6c0739cce1
  • master default protected
  • add-joust
  • blinkisync-as-preload
  • genofire/rockets-state
  • genofire/leds_rgb_get_state
  • genofire/ble-follow-py
  • genofire/haule-ble-fs-deactive
  • hauke/ble-cleanups
  • plaetzchen/ios-workaround
  • schneider/max30001-pycardium
  • schneider/max30001-epicaridum
  • schneider/max30001
  • schneider/stream-locks
  • ios-workarounds
  • schneider/fundamental-test
  • schneider/ble-buffers
  • schneider/maxim-sdk-update
  • rahix/simple_menu
  • ch3/splashscreen
  • koalo/bhi160-works-but-dirty
  • v1.7
  • v1.6
  • v1.5
  • v1.4
  • v1.3
  • v1.2
  • v1.1
  • v1.0
  • release-1
  • bootloader-v1
  • v0.0
32 results

gen-modules.py

Blame
  • Forked from card10 / firmware
    1787 commits behind the upstream repository.
    gen-modules.py 947 B
    #!/usr/bin/env python3
    # Usage: gen-modules.py <source path> <output.h> <input.c ...>
    
    import sys
    import os
    
    
    def main():
        # Get 'official' makemoduledefs.py
        path = sys.argv[1] + "/micropython/py"
        sys.path.insert(0, path)
        import makemoduledefs
    
        modules = set()
        for source in sys.argv[3:]:
            modules |= makemoduledefs.find_module_registrations(source)
    
        stdout = sys.stdout
        with open(sys.argv[2], "w") as f:
            sys.stdout = f
            makemoduledefs.generate_module_table_header(sorted(modules))
        sys.stdout = stdout
    
        try:
            os.mkdir(os.path.dirname(sys.argv[2]) + "/genhdr")
        except FileExistsError:
            pass
    
        linkname = os.path.dirname(sys.argv[2]) + "/genhdr/" + os.path.basename(sys.argv[2])
        if os.path.exists(linkname):
            os.unlink(linkname)
        os.symlink(
            "../" + os.path.basename(sys.argv[2]),
            linkname,
        )
    
    
    if __name__ == "__main__":
        main()