From 4db773a034f92b8361c96a99ddab0c69afd012b6 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Wed, 13 Nov 2024 17:33:32 +0100 Subject: [PATCH] Update base image to use Python 3.13 (#338) --- .github/workflows/builder.yml | 4 ++-- Dockerfile | 13 ++++++++----- build.yaml | 10 +++++----- patches/libcec-python313.patch | 22 ++++++++++++++++++++++ 4 files changed, 37 insertions(+), 12 deletions(-) create mode 100644 patches/libcec-python313.patch diff --git a/.github/workflows/builder.yml b/.github/workflows/builder.yml index c88436715..43f55ca92 100644 --- a/.github/workflows/builder.yml +++ b/.github/workflows/builder.yml @@ -59,12 +59,12 @@ jobs: echo "changed=true" >> $GITHUB_OUTPUT fi - - name: Build wheels cp312 + - name: Build wheels cp313 uses: home-assistant/wheels@2024.11.0 if: github.event_name == 'release' || steps.requirements.outputs.changed == 'true' with: tag: musllinux_1_2 - abi: cp312 + abi: cp313 arch: ${{ matrix.arch }} wheels-key: ${{ secrets.WHEELS_KEY }} apk: "mariadb-dev;postgresql-dev;libffi-dev" diff --git a/Dockerfile b/Dockerfile index 0fbee7578..81edfc5e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -63,6 +63,7 @@ RUN \ # libcec COPY patches/libcec-fix-null-return.patch /usr/src/ +COPY patches/libcec-python313.patch /usr/src/ RUN apk add --no-cache \ eudev-libs \ p8-platform \ @@ -76,20 +77,22 @@ RUN apk add --no-cache \ && git clone --depth 1 -b "libcec-${LIBCEC_VERSION}" https://github.com/Pulse-Eight/libcec \ && cd libcec \ && git apply ../libcec-fix-null-return.patch \ + && git apply ../libcec-python313.patch \ && mkdir build \ && cd build \ && cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ - -DPYTHON_LIBRARY="/usr/local/lib/libpython3.12.so" \ - -DPYTHON_INCLUDE_DIR="/usr/local/include/python3.12" \ + -DPYTHON_LIBRARY="/usr/local/lib/libpython3.13.so" \ + -DPYTHON_INCLUDE_DIR="/usr/local/include/python3.13" \ -DHAVE_LINUX_API=1 \ .. \ && make -j"$(nproc)" \ && make install \ - && echo "cec" > "/usr/local/lib/python3.12/site-packages/cec.pth" \ + && echo "cec" > "/usr/local/lib/python3.13/site-packages/cec.pth" \ && apk del .build-dependencies \ && rm -rf \ /usr/src/libcec \ - /usr/src/libcec-fix-null-return.patch + /usr/src/libcec-fix-null-return.patch \ + /usr/src/libcec-python313.patch # PicoTTS - it has no specific version - commit should be taken from build.json RUN apk add --no-cache \ @@ -99,7 +102,7 @@ RUN apk add --no-cache \ autoconf \ libtool \ popt-dev \ - build-base \ + build-base \ && git clone https://github.com/naggety/picotts.git pico \ && cd pico/pico \ && git reset --hard "${PICOTTS_HASH}" \ diff --git a/build.yaml b/build.yaml index 9e83db6ea..3713fccfe 100644 --- a/build.yaml +++ b/build.yaml @@ -1,10 +1,10 @@ image: ghcr.io/home-assistant/{arch}-homeassistant-base build_from: - aarch64: ghcr.io/home-assistant/aarch64-base-python:3.12-alpine3.20 - armhf: ghcr.io/home-assistant/armhf-base-python:3.12-alpine3.20 - armv7: ghcr.io/home-assistant/armv7-base-python:3.12-alpine3.20 - amd64: ghcr.io/home-assistant/amd64-base-python:3.12-alpine3.20 - i386: ghcr.io/home-assistant/i386-base-python:3.12-alpine3.20 + aarch64: ghcr.io/home-assistant/aarch64-base-python:3.13-alpine3.20 + armhf: ghcr.io/home-assistant/armhf-base-python:3.13-alpine3.20 + armv7: ghcr.io/home-assistant/armv7-base-python:3.13-alpine3.20 + amd64: ghcr.io/home-assistant/amd64-base-python:3.13-alpine3.20 + i386: ghcr.io/home-assistant/i386-base-python:3.13-alpine3.20 codenotary: signer: notary@home-assistant.io base_image: notary@home-assistant.io diff --git a/patches/libcec-python313.patch b/patches/libcec-python313.patch new file mode 100644 index 000000000..7e3f84021 --- /dev/null +++ b/patches/libcec-python313.patch @@ -0,0 +1,22 @@ +--- a/src/libcec/SwigHelper.h ++++ b/src/libcec/SwigHelper.h +@@ -119,7 +119,7 @@ namespace CEC + if (!!m_callbacks[callback]) + { + /** call the callback */ +- result = PyEval_CallObject(m_callbacks[callback], arglist); ++ result = PyObject_CallObject(m_callbacks[callback], arglist); + + /** unref the argument and result */ + if (!!arglist) +--- a/src/libcec/libcec.i ++++ b/src/libcec/libcec.i +@@ -141,7 +141,7 @@ namespace std { + if (!!lib) + { + lib->InitVideoStandalone(); +- PyEval_InitThreads(); ++ // PyEval_InitThreads(); + } + return lib; + }