python3: match packages by pattern in version check override

The override lists every python3 package by name, so it has to change
whenever the package set does, and it cannot be used as is on branches
that build a different set, like libpython3-3.13 and python3-email on
openwrt-25.12.

Check the interpreter, python3-dev and libpython3-X.Y against the
version, and accept the standard library modules and -src packages by
pattern, since they ship no executables. python3-dev now gets a real
check through python3-config and patchlevel.h, because python3-config
prints no version.

Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
This commit is contained in:
Josef Schlehofer authored and Alexandru Ardelean committed 2026-09-28 14:03:35 +03:00
1 parent f108c5ff17
commit 9274fde0ba
1 file changed
+21 -42
+21 -42
View File
@@ -2,54 +2,33 @@
# shellcheck shell=busybox
# PYTHON3_VERSION from python3-version.mk, for example 3.13
PYTHON3_VERSION="${PKG_VERSION%.*}"
case "$PKG_NAME" in
python3|\
python3-base|\
python3-light)
python3 --version | grep -Fx "Python $PKG_VERSION"
"python$PYTHON3_VERSION" --version | grep -Fx "Python $PKG_VERSION" &&
python3 --version | grep -Fx "Python $PKG_VERSION"
;;
libpython3-3.14|\
python3-asyncio|\
python3-asyncio-src|\
python3-base-src|\
python3-codecs|\
python3-codecs-src|\
python3-ctypes|\
python3-ctypes-src|\
python3-dbm|\
python3-dbm-src|\
python3-decimal|\
python3-decimal-src|\
python3-dev|\
python3-dev-src|\
python3-light-src|\
python3-logging|\
python3-logging-src|\
python3-lzma|\
python3-lzma-src|\
python3-multiprocessing|\
python3-multiprocessing-src|\
python3-ncurses|\
python3-ncurses-src|\
python3-openssl|\
python3-openssl-src|\
python3-pydoc|\
python3-pydoc-src|\
python3-readline|\
python3-readline-src|\
python3-sqlite3|\
python3-sqlite3-src|\
python3-unittest|\
python3-unittest-src|\
python3-urllib|\
python3-urllib-src|\
python3-uuid|\
python3-uuid-src|\
python3-venv|\
python3-venv-src|\
python3-xml|\
python3-xml-src)
python3-dev)
# python3-config prints no version, so check that it points to the
# headers of this version
"python$PYTHON3_VERSION-config" --includes |
grep -F -e "-I/usr/include/python$PYTHON3_VERSION" &&
grep '^#define PY_VERSION ' "/usr/include/python$PYTHON3_VERSION/patchlevel.h" |
grep -F "\"$PKG_VERSION\""
;;
libpython3-*)
# The package name carries the ABI version
[ "$PKG_NAME" = "libpython3-$PYTHON3_VERSION" ]
;;
python3-*)
# Standard library modules and -src packages ship no executables
exit 0
;;