Skip to content

Commit 37d5114

Browse files
committed
py/makemoduledefs.py: Emit useful error for legacy MP_REGISTER_MODULE.
Catch calls to legacy: MP_REGISTER_MODULE(name, module, enable) Emit a friendly error suggesting they be rewritten to: MP_REGISTER_MODULE(name, module). Signed-off-by: Phil Howard <phil@pimoroni.com>
1 parent cedb93c commit 37d5114

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

py/makemoduledefs.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from __future__ import print_function
99

10+
import sys
1011
import re
1112
import io
1213
import argparse
@@ -40,6 +41,14 @@ def generate_module_table_header(modules):
4041
for module_name, obj_module in modules:
4142
mod_def = "MODULE_DEF_{}".format(module_name.upper())
4243
mod_defs.add(mod_def)
44+
if "," in obj_module:
45+
print(
46+
"ERROR: Call to MP_REGISTER_MODULE({}, {}) should be MP_REGISTER_MODULE({}, {})\n".format(
47+
module_name, obj_module, module_name, obj_module.split(",")[0]
48+
),
49+
file=sys.stderr,
50+
)
51+
sys.exit(1)
4352
print(
4453
(
4554
"extern const struct _mp_obj_module_t {obj_module};\n"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy