tools/mpy-tool.py: List frozen modules in MICROPY_FROZEN_LIST_ITEM.

Signed-off-by: Damien George <damien@micropython.org>
pull/6791/head
Damien George 2021-01-16 02:01:26 +11:00
rodzic 925bd67cfb
commit fe16e785fe
1 zmienionych plików z 11 dodań i 0 usunięć

Wyświetl plik

@ -916,6 +916,17 @@ def freeze_mpy(base_qstrs, raw_codes):
print(" &raw_code_%s," % rc.escaped_name)
print("};")
# If a port defines MICROPY_FROZEN_LIST_ITEM then list all modules wrapped in that macro.
print("#ifdef MICROPY_FROZEN_LIST_ITEM")
for rc in raw_codes:
module_name = rc.source_file.str
if module_name.endswith("/__init__.py"):
short_name = module_name[: -len("/__init__.py")]
else:
short_name = module_name[: -len(".py")]
print('MICROPY_FROZEN_LIST_ITEM("%s", "%s")' % (short_name, module_name))
print("#endif")
def merge_mpy(raw_codes, output_file):
assert len(raw_codes) <= 31 # so var-uints all fit in 1 byte