You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trezor-firmware/core/site_scons/site_tools/micropython/moduledefs.py

14 lines
290 B

import re
import sys
def process(source, target):
re_module = re.compile(r"MP_REGISTER_MODULE\(.*?,\s*.*?\);")
for line in source:
for match in re_module.findall(line):
target.write(f"{match}\n")
if __name__ == "__main__":
process(sys.stdin, sys.stdout)