diff options
author | Phil Howard <phil@gadgetoid.com> | 2022-06-14 11:17:03 +0100 |
---|---|---|
committer | Phil Howard <phil@gadgetoid.com> | 2022-06-14 15:05:37 +0100 |
commit | 37d5114cec93258b719fcb7e8ec125dfe8b676e9 (patch) | |
tree | eba92dbfe51a721e709e52108093408a122ba86d /py | |
parent | cedb93c179f92f8d122453205950ba97a58a307b (diff) |
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>
Diffstat (limited to 'py')
-rw-r--r-- | py/makemoduledefs.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/py/makemoduledefs.py b/py/makemoduledefs.py index 5a19e687a..9061cd890 100644 --- a/py/makemoduledefs.py +++ b/py/makemoduledefs.py @@ -7,6 +7,7 @@ These are used to generate a header with the required entries for from __future__ import print_function +import sys import re import io import argparse @@ -40,6 +41,14 @@ def generate_module_table_header(modules): for module_name, obj_module in modules: mod_def = "MODULE_DEF_{}".format(module_name.upper()) mod_defs.add(mod_def) + if "," in obj_module: + print( + "ERROR: Call to MP_REGISTER_MODULE({}, {}) should be MP_REGISTER_MODULE({}, {})\n".format( + module_name, obj_module, module_name, obj_module.split(",")[0] + ), + file=sys.stderr, + ) + sys.exit(1) print( ( "extern const struct _mp_obj_module_t {obj_module};\n" |