Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/embedding/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
#define MICROPY_ENABLE_COMPILER (1)
#define MICROPY_ENABLE_GC (1)
#define MICROPY_PY_GC (1)
#define MICROPY_PY_SYS (0)
3 changes: 3 additions & 0 deletions ports/bare-arm/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions ports/minimal/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion ports/nrf/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion ports/powerpc/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions ports/unix/variants/minimal/mpconfigvariant.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 0 additions & 1 deletion ports/zephyr/mpconfigport_minimal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions py/builtinimport.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static mp_import_stat_t stat_module(vstr_t *path) {
// path (i.e. "<entry>/mod_name(.py)").
static mp_import_stat_t stat_top_level(qstr mod_name, vstr_t *dest) {
DEBUG_printf("stat_top_level: '%s'\n", qstr_str(mod_name));
#if MICROPY_PY_SYS
#if MICROPY_PY_SYS && MICROPY_PY_SYS_PATH
size_t path_num;
mp_obj_t *path_items;
mp_obj_get_array(mp_sys_path, &path_num, &path_items);
Expand Down Expand Up @@ -367,7 +367,7 @@ static mp_obj_t process_import_at_level(qstr full_mod_name, qstr level_mod_name,
// Immediately return if the module at this level is already loaded.
mp_map_elem_t *elem;

#if MICROPY_PY_SYS
#if MICROPY_PY_SYS && MICROPY_PY_SYS_PATH
// If sys.path is empty, the intention is to force using a built-in. This
// means we should also ignore any loaded modules with the same name
// which may have come from the filesystem.
Expand Down
2 changes: 1 addition & 1 deletion py/mpconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading