summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2021-01-16 02:01:26 +1100
committerDamien George <damien@micropython.org>2021-01-29 23:57:10 +1100
commitfe16e785fe76ca2c84b82512c427c7fa57176abe (patch)
tree129bf356cfd6fb2f98498abfae2db8f7c2cf76ed
parent925bd67cfb1607264fae79a4fdf5e79ab1ae46aa (diff)
tools/mpy-tool.py: List frozen modules in MICROPY_FROZEN_LIST_ITEM.
Signed-off-by: Damien George <damien@micropython.org>
-rwxr-xr-xtools/mpy-tool.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py
index de7cfe5d6..ea756d3ee 100755
--- a/tools/mpy-tool.py
+++ b/tools/mpy-tool.py
@@ -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