py/mpconfig: Enable the sys module at all feature levels by default.

This is a pretty fundamental module, and even minimal ports like unix and
zephyr minimal have it enabled.  So, enabled it by default at the lowest
feature level.

Most things in the `sys` module are configurable, and off by default, so it
shouldn't add too much to ports that don't already have it enabled (which
is just the minimal port).

Also note that `sys` is still disabled on the bare-arm port, to keep that
ultra minimal.  It means we now have bare-arm without `sys` and the minimal
port with `sys`.  That will allow different code size comparisons if/when
new `sys` features are added.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2025-08-15 13:11:51 +10:00
parent 14e9c00cb9
commit a3f9dec788
8 changed files with 12 additions and 6 deletions

View file

@ -13,3 +13,4 @@
#define MICROPY_ENABLE_COMPILER (1)
#define MICROPY_ENABLE_GC (1)
#define MICROPY_PY_GC (1)
#define MICROPY_PY_SYS (0)

View file

@ -37,6 +37,9 @@
// Python internal features
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NONE)
// Fine control over Python builtins, classes, modules, etc.
#define MICROPY_PY_SYS (0)
// Type definitions for the specific machine
typedef int32_t mp_int_t; // must be pointer size

View file

@ -21,6 +21,12 @@
// Use the minimum headroom in the chunk allocator for parse nodes.
#define MICROPY_ALLOC_PARSE_CHUNK_INIT (16)
// Disable all optional sys module features.
#define MICROPY_PY_SYS_MODULES (0)
#define MICROPY_PY_SYS_EXIT (0)
#define MICROPY_PY_SYS_PATH (0)
#define MICROPY_PY_SYS_ARGV (0)
// type definitions for the specific machine
typedef intptr_t mp_int_t; // must be pointer size

View file

@ -289,7 +289,6 @@
#define MICROPY_PY_GENERATOR_PEND_THROW (1)
#define MICROPY_PY_MATH (1)
#define MICROPY_PY_STRUCT (1)
#define MICROPY_PY_SYS (1)
#define MICROPY_PY_SYS_PATH_ARGV_DEFAULTS (1)
#endif

View file

@ -81,7 +81,6 @@
#define MICROPY_PY_CMATH (0)
#define MICROPY_PY_IO (0)
#define MICROPY_PY_STRUCT (1)
#define MICROPY_PY_SYS (1)
#define MICROPY_MODULE_FROZEN_MPY (1)
#define MICROPY_CPYTHON_COMPAT (0)
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)

View file

@ -61,6 +61,5 @@
#define MICROPY_PY_BUILTINS_RANGE_ATTRS (1)
#define MICROPY_PY_GENERATOR_PEND_THROW (1)
// Enable just the sys and os built-in modules.
#define MICROPY_PY_SYS (1)
// Add just the os built-in module.
#define MICROPY_PY_OS (1)

View file

@ -59,7 +59,6 @@
#define MICROPY_PY_BUILTINS_STR_OP_MODULO (1)
#define MICROPY_PY_BUILTINS_BYTEARRAY (1)
#define MICROPY_PY_BUILTINS_DICT_FROMKEYS (1)
#define MICROPY_PY_SYS (1)
#ifdef CONFIG_BOARD
#define MICROPY_HW_BOARD_NAME "zephyr-" CONFIG_BOARD

View file

@ -1610,7 +1610,7 @@ typedef time_t mp_timestamp_t;
// Whether to provide "sys" module
#ifndef MICROPY_PY_SYS
#define MICROPY_PY_SYS (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_CORE_FEATURES)
#define MICROPY_PY_SYS (1)
#endif
// Whether to initialise "sys.path" and "sys.argv" to their defaults in mp_init()