move non-u names for native modules to circuitpy_mpconfig.h

This commit is contained in:
Dan Halbert 2019-02-18 12:08:23 -05:00
parent 339a22752b
commit ba77a9ca80
2 changed files with 16 additions and 3 deletions

View File

@ -460,12 +460,26 @@ extern const struct _mp_obj_module_t ustack_module;
#define USTACK_MODULE
#endif
// These modules are not yet in shared-bindings, but we prefer the non-uxxx names.
#if MICROPY_PY_UERRNO
#define ERRNO_MODULE
{ MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_module_uerrno) },
#else
#define ERRNO_MODULE
#endif
#if MICROPY_PY_UJSON
#define JSON_MODULE { MP_ROM_QSTR(MP_QSTR_json), MP_ROM_PTR(&mp_module_ujson) },
#else
#define JSON_MODULE
#endif
#if MICROPY_PY_URE
#define RE_MODULE { MP_ROM_QSTR(MP_QSTR_re), MP_ROM_PTR(&mp_module_ure) },
#else
#define RE_MODULE
#endif
// Define certain native modules with weak links so they can be replaced with Python
// implementations. This list may grow over time.
#define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS \
@ -495,6 +509,7 @@ extern const struct _mp_obj_module_t ustack_module;
DIGITALIO_MODULE \
TERMINALIO_MODULE \
DISPLAYIO_MODULE \
ERRNO_MODULE \
GAMEPAD_MODULE \
I2CSLAVE_MODULE \
JSON_MODULE \
@ -507,6 +522,7 @@ extern const struct _mp_obj_module_t ustack_module;
PIXELBUF_MODULE \
PULSEIO_MODULE \
RANDOM_MODULE \
RE_MODULE \
RTC_MODULE \
SAMD_MODULE \
STAGE_MODULE \

View File

@ -179,7 +179,6 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = {
// extmod modules
#if MICROPY_PY_UERRNO
{ MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_module_uerrno) },
{ MP_ROM_QSTR(MP_QSTR_uerrno), MP_ROM_PTR(&mp_module_uerrno) },
#endif
#if MICROPY_PY_UCTYPES
@ -189,11 +188,9 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = {
{ MP_ROM_QSTR(MP_QSTR_uzlib), MP_ROM_PTR(&mp_module_uzlib) },
#endif
#if MICROPY_PY_UJSON
{ MP_ROM_QSTR(MP_QSTR_json), MP_ROM_PTR(&mp_module_ujson) },
{ MP_ROM_QSTR(MP_QSTR_ujson), MP_ROM_PTR(&mp_module_ujson) },
#endif
#if MICROPY_PY_URE
{ MP_ROM_QSTR(MP_QSTR_re), MP_ROM_PTR(&mp_module_ure) },
{ MP_ROM_QSTR(MP_QSTR_ure), MP_ROM_PTR(&mp_module_ure) },
#endif
#if MICROPY_PY_UHEAPQ