mirror of
https://github.com/openwrt/packages.git
synced 2026-10-12 18:57:35 +04:00
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> (cherry picked from commit9274fde0ba) [take the new file, openwrt-25.12 does not have the package list from9d69e4fa2] Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
This commit is contained in:
1 parent
39754e6b28
commit
0c9829c65f
1 file changed
+22
-23
@@ -1,35 +1,34 @@
|
||||
#!/bin/sh
|
||||
|
||||
# shellckeck shell=busybox
|
||||
# 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"
|
||||
;;
|
||||
|
||||
python3-asyncio|\
|
||||
python3-base-src|\
|
||||
python3-codecs|\
|
||||
python3-ctypes|\
|
||||
python3-dbm|\
|
||||
python3-decimal|\
|
||||
python3-dev|\
|
||||
python3-light-src|\
|
||||
python3-logging|\
|
||||
python3-lzma|\
|
||||
python3-multiprocessing|\
|
||||
python3-ncurses|\
|
||||
python3-openssl|\
|
||||
python3-pydoc|\
|
||||
python3-readline|\
|
||||
python3-sqlite3|\
|
||||
python3-unittest|\
|
||||
python3-urllib|\
|
||||
python3-uuid|\
|
||||
python3-venv|\
|
||||
python3-xml)
|
||||
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
|
||||
;;
|
||||
|
||||
|
||||
Reference in new issue
Block a user