tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Python's SOABI tag vs PLISTs



Only two packages in pkgsrc proper had this problem. There are a few
more in wip though so it is warranted to make a catch-all solution.
Here is my proposed patch.

Index: lang/python/extension.mk
===================================================================
RCS file: /cvsroot/pkgsrc/lang/python/extension.mk,v
retrieving revision 1.66
diff -p -u -r1.66 extension.mk
--- lang/python/extension.mk	7 Jan 2025 19:35:08 -0000	1.66
+++ lang/python/extension.mk	3 May 2025 18:17:06 -0000
@@ -54,9 +54,20 @@ do-test:
 
 .endif
 
+# PYSOABISUFFIX should match the output of the following command
+# on the host, without the leading dot.
+# python -c "import importlib; print(importlib.machinery.EXTENSION_SUFFIXES[0])"
+.if !empty(MACHINE_PLATFORM:MLinux-*-*)
+PYSOABISUFFIX?=	cpython-${PYTHON_VERSION}-${MACHINE_ARCH}-linux-gnu.so
+.elif !empty(MACHINE_PLATFORM:MDarwin-*-*)
+PYSOABISUFFIX?=	cpython-${PYTHON_VERSION}-darwin.so
+.else
+PYSOABISUFFIX?=	cpython-${PYTHON_VERSION}.so
+.endif
+
 .if defined(PY_PATCHPLIST)
 PLIST_SUBST+=	PYINC=${PYINC} PYLIB=${PYLIB} PYSITELIB=${PYSITELIB}
-PLIST_SUBST+=	PYVERSSUFFIX=${PYVERSSUFFIX}
+PLIST_SUBST+=	PYVERSSUFFIX=${PYVERSSUFFIX} PYSOABISUFFIX=${PYSOABISUFFIX}
 .endif
 
 # mostly for ALTERNATIVES files
@@ -67,6 +78,7 @@ FILES_SUBST+=	PYVERSSUFFIX=${PYVERSSUFFI
 .if empty(_PYTHON_VERSION:M2?)
 PLIST_AWK+=		-f ${PKGSRCDIR}/lang/python/plist-python.awk
 PLIST_AWK_ENV+=		PYVERS="${PYVERSSUFFIX:S/.//}"
+EARLY_PRINT_PLIST_AWK+=	/lib\// { sub(/\.${PYSOABISUFFIX}$$/, ".$${PYSOABISUFFIX}") }
 EARLY_PRINT_PLIST_AWK+=	/^[^@]/ && /[^\/]+\.py[co]$$/ {
 EARLY_PRINT_PLIST_AWK+=	gsub(/__pycache__\//, "")
 EARLY_PRINT_PLIST_AWK+=	gsub(/opt-1\.pyc$$/, "pyo")
Index: cad/py-gdstk/PLIST
===================================================================
RCS file: /cvsroot/pkgsrc/cad/py-gdstk/PLIST,v
retrieving revision 1.5
diff -p -u -r1.5 PLIST
--- cad/py-gdstk/PLIST	27 Jan 2025 22:39:16 -0000	1.5
+++ cad/py-gdstk/PLIST	3 May 2025 18:17:07 -0000
@@ -6,6 +6,6 @@ ${PYSITELIB}/${WHEEL_INFODIR}/licenses/L
 ${PYSITELIB}/gdstk/__init__.py
 ${PYSITELIB}/gdstk/__init__.pyc
 ${PYSITELIB}/gdstk/__init__.pyo
-${PYSITELIB}/gdstk/_gdstk.cpython-${PYVERS}.so
+${PYSITELIB}/gdstk/_gdstk.${PYSOABISUFFIX}
 ${PYSITELIB}/gdstk/_gdstk.pyi
 ${PYSITELIB}/gdstk/py.typed
Index: x11/py-qwt-qt5/PLIST
===================================================================
RCS file: /cvsroot/pkgsrc/x11/py-qwt-qt5/PLIST,v
retrieving revision 1.9
diff -p -u -r1.9 PLIST
--- x11/py-qwt-qt5/PLIST	11 May 2024 20:54:11 -0000	1.9
+++ x11/py-qwt-qt5/PLIST	3 May 2025 18:17:07 -0000
@@ -2,7 +2,7 @@
 ${PYSITELIB}/${WHEEL_INFODIR}/METADATA
 ${PYSITELIB}/${WHEEL_INFODIR}/RECORD
 ${PYSITELIB}/${WHEEL_INFODIR}/WHEEL
-${PYSITELIB}/PyQt5/Qwt.cpython-${PYTHON_VERSION}.so
+${PYSITELIB}/PyQt5/Qwt.${PYSOABISUFFIX}
 ${PYSITELIB}/PyQt5/bindings/Qwt/Qwt.toml
 ${PYSITELIB}/PyQt5/bindings/Qwt/Qwt_Qt5.sip
 ${PYSITELIB}/PyQt5/bindings/Qwt/conversions.sip


Home | Main Index | Thread Index | Old Index