Skip to content

Commit

Permalink
pyqt4: update from AUR
Browse files Browse the repository at this point in the history
  • Loading branch information
noptrix committed Sep 2, 2023
1 parent 80b985f commit 6e83931
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 10 deletions.
48 changes: 48 additions & 0 deletions packages/pyqt4/0001-Fix-compilation-against-Python-3.11.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
From eed66bc10c5ec5e650de8b03dc1ee0b373f01a00 Mon Sep 17 00:00:00 2001
From: LingMan <[email protected]>
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

26 changes: 16 additions & 10 deletions packages/pyqt4/PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Maintainer: Stephan Springer <[email protected]>
# Contributor: Stephan Springer <[email protected]>
# Contributor: Felix Yan <[email protected]>
# Contributor: Andrea Scarpino <[email protected]>
# Contributor: Douglas Soares de Andrade <[email protected]>
Expand All @@ -8,16 +8,23 @@ pkgbase=pyqt4
pkgname=('pyqt4-common' 'python-pyqt4' 'python2-pyqt4')
pkgver=4.12.3
pkgrel=12
arch=('x86_64')
url='http://www.riverbankcomputing.com/software/pyqt/intro'
arch=('x86_64' 'aarch64')
url='https://riverbankcomputing.com/software/pyqt/intro'
license=('GPL')
makedepends=('sip4' 'python-sip-pyqt4' 'python2-sip-pyqt4' 'dbus-python'
'phonon-qt4' 'mesa' 'python2-opengl')
source=("http://downloads.sourceforge.net/pyqt/PyQt4_gpl_x11-${pkgver}.tar.gz")
sha256sums=('a00f5abef240a7b5852b7924fa5fdf5174569525dc076cd368a566619e56d472')
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"
'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}
}

Expand Down Expand Up @@ -65,7 +72,7 @@ package_pyqt4-common() {

package_python-pyqt4() {
pkgdesc="A set of Python 3.x bindings for the Qt toolkit"
depends=('sip' 'python-sip-pyqt4' 'dbus-python' 'pyqt4-common')
depends=('python-sip-pyqt4' 'python-dbus' 'pyqt4-common')
optdepends=('phonon-qt4: enable audio and video in PyQt applications')
replaces=('pyqt')
conflicts=('pyqt')
Expand All @@ -82,7 +89,7 @@ package_python-pyqt4() {

package_python2-pyqt4() {
pkgdesc="A set of Python 2.x bindings for the Qt toolkit"
depends=('sip' 'python2-sip-pyqt4' 'dbus-python' 'pyqt4-common')
depends=('python2-sip-pyqt4' 'python2-dbus' 'pyqt4-common')
optdepends=('phonon-qt4: enable audio and video in PyQt applications'
'python2-opengl: enable OpenGL 3D graphics in PyQt applications')
replaces=('python2-pyqt')
Expand All @@ -101,4 +108,3 @@ package_python2-pyqt4() {
rm "${pkgdir}"/usr/lib/qt4/plugins/designer/libpyqt4.so
rm "${pkgdir}"/usr/share/qt4/qsci/api/python/PyQt4.api
}

0 comments on commit 6e83931

Please sign in to comment.