diff options
author | LingMan | 2023-05-11 03:18:38 +0200 |
---|---|---|
committer | LingMan | 2023-05-11 03:18:38 +0200 |
commit | 7b10d5c07d755b10ee770328d94b902b4c003ff6 (patch) | |
tree | a5c0623f8a036d31973a0e835e72e8c06850bbd0 | |
parent | 926aff2c43fc2dc3d1dc359f97e6b0f8925e2748 (diff) | |
download | aur-pyqt4.tar.gz |
Fix compilation against Python 3.11+
-rw-r--r-- | .SRCINFO | 5 | ||||
-rw-r--r-- | 0001-Fix-compilation-against-Python-3.11.patch | 48 | ||||
-rw-r--r-- | PKGBUILD | 13 |
3 files changed, 61 insertions, 5 deletions
@@ -1,6 +1,6 @@ pkgbase = pyqt4 pkgver = 4.12.3 - pkgrel = 5 + pkgrel = 6 url = https://riverbankcomputing.com/software/pyqt/intro arch = x86_64 license = GPL @@ -13,7 +13,9 @@ pkgbase = pyqt4 makedepends = python2-opengl makedepends = python2-dbus source = https://downloads.sourceforge.net/project/pyqt/PyQt4/PyQt-4.12.3/PyQt4_gpl_x11-4.12.3.tar.gz + source = 0001-Fix-compilation-against-Python-3.11.patch sha256sums = a00f5abef240a7b5852b7924fa5fdf5174569525dc076cd368a566619e56d472 + sha256sums = ae6f13d26d8f94f30eb48058300a5b3d7fa9e7060a9f808abad61f25ba35ebe9 pkgname = pyqt4-common pkgdesc = Common PyQt files shared between python-pyqt4 and python2-pyqt4 @@ -42,4 +44,3 @@ pkgname = python2-pyqt4 provides = python2-pyqt=4.12.3 conflicts = python2-pyqt replaces = python2-pyqt - diff --git a/0001-Fix-compilation-against-Python-3.11.patch b/0001-Fix-compilation-against-Python-3.11.patch new file mode 100644 index 000000000000..337d9c1bde13 --- /dev/null +++ b/0001-Fix-compilation-against-Python-3.11.patch @@ -0,0 +1,48 @@ +From eed66bc10c5ec5e650de8b03dc1ee0b373f01a00 Mon Sep 17 00:00:00 2001 +From: LingMan <LingMan@users.noreply.github.com> +Date: Thu, 11 May 2023 02:59:27 +0200 +Subject: [PATCH] Fix compilation against Python 3.11+ + +With Python 3.11 the internal structure of PyFrameObject (AKA struct _frame) has been removed from +the public API. +De jure it was always an opaque struct but now there have also been de facto changes. + +The fix is to simply call the official PyFrame_GetBack API. + +This change contains a fallback implementation of PyFrame_GetBack for Python 3.8 and older +(including 2.7) as documented here: +https://docs.python.org/3/whatsnew/3.11.html#whatsnew311-c-api-porting +--- + qpy/QtCore/qpycore_classinfo.cpp | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/qpy/QtCore/qpycore_classinfo.cpp b/qpy/QtCore/qpycore_classinfo.cpp +index a626df3..60de2b7 100644 +--- a/qpy/QtCore/qpycore_classinfo.cpp ++++ b/qpy/QtCore/qpycore_classinfo.cpp +@@ -25,6 +25,13 @@ + + #include "qpycore_classinfo.h" + ++#if PY_VERSION_HEX < 0x030900B1 ++static inline PyFrameObject* PyFrame_GetBack(PyFrameObject *frame) ++{ ++ Py_XINCREF(frame->f_back); ++ return frame->f_back; ++} ++#endif + + static QMultiHash<const PyFrameObject *, ClassInfo> class_info_hash; + +@@ -36,7 +43,7 @@ PyObject *qpycore_ClassInfo(const char *name, const char *value) + + // We need the frame we were called from, not the current one. + if (frame) +- frame = frame->f_back; ++ frame = PyFrame_GetBack(frame); + + if (!frame) + { +-- +2.40.1 + @@ -7,17 +7,24 @@ pkgbase=pyqt4 pkgname=('pyqt4-common' 'python-pyqt4' 'python2-pyqt4') pkgver=4.12.3 -pkgrel=5 +pkgrel=6 arch=('x86_64') url='https://riverbankcomputing.com/software/pyqt/intro' license=('GPL') makedepends=('sip4' 'python-sip-pyqt4' 'python2-sip-pyqt4' 'python-dbus' 'phonon-qt4' 'mesa' 'python2-opengl' 'python2-dbus') -source=("https://downloads.sourceforge.net/project/pyqt/PyQt4/PyQt-${pkgver}/PyQt4_gpl_x11-${pkgver}.tar.gz") -sha256sums=('a00f5abef240a7b5852b7924fa5fdf5174569525dc076cd368a566619e56d472') +source=("https://downloads.sourceforge.net/project/pyqt/PyQt4/PyQt-${pkgver}/PyQt4_gpl_x11-${pkgver}.tar.gz" + '0001-Fix-compilation-against-Python-3.11.patch') +sha256sums=('a00f5abef240a7b5852b7924fa5fdf5174569525dc076cd368a566619e56d472' + 'ae6f13d26d8f94f30eb48058300a5b3d7fa9e7060a9f808abad61f25ba35ebe9') prepare() { sed -i -e "/'PyQt4\.sip', '-f', sip_flags/s/'-f', //" PyQt4_gpl_x11-${pkgver}/configure-ng.py + + cd PyQt4_gpl_x11-${pkgver} + patch --strip=1 --input=../0001-Fix-compilation-against-Python-3.11.patch + + cd .. cp -a PyQt4_gpl_x11-${pkgver}{,-py2} } |