From 5eae76ff734476ca4912d2783e4a5c025119729f Mon Sep 17 00:00:00 2001 From: Albert Slepak Date: Fri, 31 Jul 2026 16:43:36 -0700 Subject: [PATCH 1/2] feat(userland): set PYTHONHOME so Python finds its stdlib --- userland/apps/init/src/init.c | 1 + 1 file changed, 1 insertion(+) diff --git a/userland/apps/init/src/init.c b/userland/apps/init/src/init.c index 26ba5230..3fda4fab 100644 --- a/userland/apps/init/src/init.c +++ b/userland/apps/init/src/init.c @@ -23,6 +23,7 @@ int main(void) { setenv("HOME", "/", 1); setenv("SHELL", "/bin/shell", 1); setenv("LANG", "C", 1); + setenv("PYTHONHOME", "/usr", 1); int dm_handle = proc_exec("/bin/stlxdm", NULL); if (dm_handle >= 0) { From c84e965e58640b443171329631e03f7dd4daa2d1 Mon Sep 17 00:00:00 2001 From: Albert Slepak Date: Tue, 4 Aug 2026 11:14:50 -0700 Subject: [PATCH 2/2] fix(userland): made Python's static C modules importable Modules.Setup.local was staged into the build tree after configure ran, so makesetup generated the module inittab without the static entries. The C modules like math compiled but were never registered, so import math and everything depending on it failed. Staging Setup.local before configure records them in config.c. --- userland/apps/python/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/userland/apps/python/Makefile b/userland/apps/python/Makefile index 164c2526..f98676e2 100644 --- a/userland/apps/python/Makefile +++ b/userland/apps/python/Makefile @@ -138,10 +138,11 @@ $(PATCH_STAMP): | $(EXTRACT_STAMP) @touch $@ $(CONFIGURE_STAMP): $(PATCH_STAMP) config.site Modules.Setup.local - @mkdir -p $(BUILD_DIR) + @mkdir -p $(BUILD_DIR)/Modules @echo "[CONF] CPython $(PY_VER) ($(ARCH))" @echo " SYSROOT=$(SYSROOT)" @echo " BUILTINS_LIB=$(BUILTINS_LIB)" + @cp Modules.Setup.local $(BUILD_DIR)/Modules/Setup.local @cd $(BUILD_DIR) && \ CONFIG_SITE=$(CURDIR)/config.site \ CC="$(CC)" \ @@ -160,7 +161,6 @@ $(CONFIGURE_STAMP): $(PATCH_STAMP) config.site Modules.Setup.local --disable-ipv6 \ --without-ensurepip \ --with-build-python=$$(command -v $(HOST_PYTHON)) - @cp Modules.Setup.local $(BUILD_DIR)/Modules/Setup.local @touch $@ $(BUILD_STAMP): $(CONFIGURE_STAMP)