diff --git a/meta-opencentauri/images/opencentauri-image-base.bb b/meta-opencentauri/images/opencentauri-image-base.bb index 7bbfddb3..c18a6d2c 100644 --- a/meta-opencentauri/images/opencentauri-image-base.bb +++ b/meta-opencentauri/images/opencentauri-image-base.bb @@ -9,6 +9,8 @@ inherit core-image IMAGE_FEATURES += "ssh-server-dropbear" +BAD_RECOMMENDATIONS += "python3-unittest" + CORE_IMAGE_EXTRA_INSTALL += "\ usbutils \ libgpiod \ diff --git a/meta-opencentauri/recipes-apps/klipper/files/klipper-init-d b/meta-opencentauri/recipes-apps/klipper/files/klipper-init-d index 881925e2..d0b44c47 100644 --- a/meta-opencentauri/recipes-apps/klipper/files/klipper-init-d +++ b/meta-opencentauri/recipes-apps/klipper/files/klipper-init-d @@ -12,6 +12,9 @@ KLIPPY_EXEC="/usr/bin/python3" KLIPPY_ARGS="/usr/share/klipper/klippy/klippy.py /etc/klipper/config/printer.cfg -l /board-resource/klippy.log -a /run/klippy.sock" PIDFILE="/var/run/klipper.pid" +export PYTHONDONTWRITEBYTECODE=1 +export PYTHONNOUSERSITE=1 + case "$1" in start) echo "Starting klipper..." diff --git a/meta-opencentauri/recipes-apps/klipper/kalico_2026.02.00.bb b/meta-opencentauri/recipes-apps/klipper/kalico_2026.02.00.bb index 4f30634f..60dbcfe3 100644 --- a/meta-opencentauri/recipes-apps/klipper/kalico_2026.02.00.bb +++ b/meta-opencentauri/recipes-apps/klipper/kalico_2026.02.00.bb @@ -15,7 +15,7 @@ SRC_URI += " \ file://misc.cfg \ " -inherit python3-dir update-rc.d +inherit python3-dir python3native update-rc.d RDEPENDS:${PN} = " \ python3 \ @@ -72,9 +72,10 @@ do_install() { install -d ${D}${datadir}/klipper cp -r ${S}/klippy ${D}${datadir}/klipper/ - # Remove any .pyc files to avoid TMPDIR references - find ${D} -name '*.pyc' -delete - find ${D} -name '__pycache__' -type d -exec rm -rf {} + 2>/dev/null || true + # Precompile optimized bytecode in place. Keep .py sources for Kalico: + # klippy/compat.py checks for on-disk .py files when resolving legacy imports. + nativepython3 -OO -m compileall -b -f ${D}${datadir}/klipper/klippy + find ${D}${datadir}/klipper -name '__pycache__' -type d -exec rm -rf {} + 2>/dev/null || true # Install default kalico config install -d ${D}${sysconfdir}/klipper diff --git a/meta-opencentauri/recipes-apps/moonraker/files/moonraker-init-d b/meta-opencentauri/recipes-apps/moonraker/files/moonraker-init-d index 8322199d..2ed36459 100644 --- a/meta-opencentauri/recipes-apps/moonraker/files/moonraker-init-d +++ b/meta-opencentauri/recipes-apps/moonraker/files/moonraker-init-d @@ -14,6 +14,8 @@ PIDFILE="/var/run/moonraker.pid" export PYTHONPATH="/usr/share/moonraker" export TMPDIR="/user-resource/.tmp" +export PYTHONDONTWRITEBYTECODE=1 +export PYTHONNOUSERSITE=1 case "$1" in start) diff --git a/meta-opencentauri/recipes-apps/moonraker/moonraker_0.10.0.bb b/meta-opencentauri/recipes-apps/moonraker/moonraker_0.10.0.bb index 69801769..7e98e814 100644 --- a/meta-opencentauri/recipes-apps/moonraker/moonraker_0.10.0.bb +++ b/meta-opencentauri/recipes-apps/moonraker/moonraker_0.10.0.bb @@ -17,7 +17,7 @@ S = "${WORKDIR}/git" PR = "r1" -inherit python3-dir update-rc.d +inherit python3-dir python3native update-rc.d DEPENDS = " \ python3-native \ @@ -66,6 +66,14 @@ do_install() { install -d ${D}${datadir}/moonraker cp -r ${S}/moonraker ${D}${datadir}/moonraker/ + # Precompile optimized bytecode in place. Keep metadata.py because + # Moonraker launches it directly for gcode metadata extraction. + nativepython3 -OO -m compileall -b -f ${D}${datadir}/moonraker/moonraker + find ${D}${datadir}/moonraker/moonraker -name '*.py' \ + ! -path "${D}${datadir}/moonraker/moonraker/components/file_manager/metadata.py" \ + -delete + find ${D}${datadir}/moonraker -name '__pycache__' -type d -exec rm -rf {} + 2>/dev/null || true + # Install default moonraker config install -d ${D}${sysconfdir}/klipper install -d ${D}${sysconfdir}/klipper/config diff --git a/meta-opencentauri/recipes-devtools/python/python3_%.bbappend b/meta-opencentauri/recipes-devtools/python/python3_%.bbappend index d1881b4a..fa616809 100644 --- a/meta-opencentauri/recipes-devtools/python/python3_%.bbappend +++ b/meta-opencentauri/recipes-devtools/python/python3_%.bbappend @@ -1 +1,11 @@ +PACKAGECONFIG:remove:class-target = "gdbm tk tcl readline" PACKAGECONFIG:append:class-target = " lto pgo" + +BAD_RECOMMENDATIONS += " \ + python3-tkinter \ + python3-idle \ + python3-pydoc \ + python3-doctest \ + python3-2to3 \ + python3-dev \ +" diff --git a/meta-opencentauri/recipes-python/tornado/python3-tornado_%.bbappend b/meta-opencentauri/recipes-python/tornado/python3-tornado_%.bbappend new file mode 100644 index 00000000..2eabf894 --- /dev/null +++ b/meta-opencentauri/recipes-python/tornado/python3-tornado_%.bbappend @@ -0,0 +1 @@ +RDEPENDS:${PN}:remove = "python3-unittest"