shiboken2, python3-pyside2: update to 5.15.10, rebuild for Python 3.12
This commit is contained in:
parent
8808a9cb96
commit
47c0af077a
6 changed files with 176 additions and 8 deletions
15
srcpkgs/python3-pyside2/patches/cmake-qtquick-includes.patch
Normal file
15
srcpkgs/python3-pyside2/patches/cmake-qtquick-includes.patch
Normal file
|
@ -0,0 +1,15 @@
|
|||
This is a terrible hack. PySide2 fails to build with Qt5 (even on Py3.11)
|
||||
because shiboken can't find private interfaces for QtQuick widgets. Brute-force
|
||||
the necessary include paths to make the build work.
|
||||
|
||||
--- ./sources/pyside2/cmake/Macros/PySideModules.cmake.orig 2023-09-27 23:51:40.096157231 -0400
|
||||
+++ ./sources/pyside2/cmake/Macros/PySideModules.cmake 2023-09-27 23:52:19.825408838 -0400
|
||||
@@ -93,7 +93,7 @@
|
||||
# Contains include directories to pass to shiboken's preprocessor.
|
||||
# Workaround: Added ${QT_INCLUDE_DIR}/QtCore until
|
||||
# qtdeclarative/8d560d1bf0a747bf62f73fad6b6774095442d9d2 has reached qt5.git
|
||||
- string(REPLACE ";" ${PATH_SEP} core_includes "${Qt5Core_INCLUDE_DIRS}")
|
||||
+ string(REPLACE ";" ${PATH_SEP} core_includes "${Qt5Core_INCLUDE_DIRS};${Qt5Quick_PRIVATE_INCLUDE_DIRS}")
|
||||
set(shiboken_include_dirs ${pyside2_SOURCE_DIR}${PATH_SEP}${QT_INCLUDE_DIR}${PATH_SEP}${core_includes})
|
||||
set(shiboken_framework_include_dirs_option "")
|
||||
if(CMAKE_HOST_APPLE)
|
|
@ -3,7 +3,7 @@
|
|||
@@ -94,7 +94,7 @@
|
||||
# Workaround: Added ${QT_INCLUDE_DIR}/QtCore until
|
||||
# qtdeclarative/8d560d1bf0a747bf62f73fad6b6774095442d9d2 has reached qt5.git
|
||||
string(REPLACE ";" ${PATH_SEP} core_includes "${Qt5Core_INCLUDE_DIRS}")
|
||||
string(REPLACE ";" ${PATH_SEP} core_includes "${Qt5Core_INCLUDE_DIRS};${Qt5Quick_PRIVATE_INCLUDE_DIRS}")
|
||||
- set(shiboken_include_dirs ${pyside2_SOURCE_DIR}${PATH_SEP}${QT_INCLUDE_DIR}${PATH_SEP}${core_includes})
|
||||
+ set(shiboken_include_dirs ${pyside2_SOURCE_DIR}${PATH_SEP}${QT_INCLUDE_DIR}${PATH_SEP}${core_includes}${PATH_SEP}${CMAKE_FIND_ROOT_PATH}/usr/include)
|
||||
set(shiboken_framework_include_dirs_option "")
|
||||
|
|
152
srcpkgs/python3-pyside2/patches/python3.12.patch
Normal file
152
srcpkgs/python3-pyside2/patches/python3.12.patch
Normal file
|
@ -0,0 +1,152 @@
|
|||
This is a combination of three patches:
|
||||
|
||||
1. In generate_pyi.py, avoid writing to immutable typing.TypeVar.__repr__.
|
||||
2. Backport PySide6 fix https://codereview.qt-project.org/c/pyside/pyside-setup/+/506424
|
||||
3. Backport PySide6 fix https://codereview.qt-project.org/c/pyside/pyside-setup/+/506930
|
||||
|
||||
diff -ur python3-pyside2-5.15.5.orig/sources/pyside2/libpyside/pysideproperty.cpp python3-pyside2-5.15.5/sources/pyside2/libpyside/pysideproperty.cpp
|
||||
--- python3-pyside2-5.15.5.orig/sources/pyside2/libpyside/pysideproperty.cpp 2023-09-27 21:52:01.389249419 -0400
|
||||
+++ python3-pyside2-5.15.5/sources/pyside2/libpyside/pysideproperty.cpp 2023-09-27 21:57:06.265042322 -0400
|
||||
@@ -46,6 +46,7 @@
|
||||
|
||||
#include <shiboken.h>
|
||||
#include <signature.h>
|
||||
+#include <basewrapper.h>
|
||||
|
||||
using namespace Shiboken;
|
||||
|
||||
@@ -444,7 +445,13 @@
|
||||
static PyObject *getFromType(PyTypeObject *type, PyObject *name)
|
||||
{
|
||||
PyObject *attr = nullptr;
|
||||
- attr = PyDict_GetItem(type->tp_dict, name);
|
||||
+
|
||||
+ {
|
||||
+ Shiboken::Type::TypeDict tpDict(type);
|
||||
+ Q_ASSERT(tpDict);
|
||||
+ attr = PyDict_GetItem(tpDict, name);
|
||||
+ }
|
||||
+
|
||||
if (!attr) {
|
||||
PyObject *bases = type->tp_bases;
|
||||
int size = PyTuple_GET_SIZE(bases);
|
||||
diff -ur python3-pyside2-5.15.5.orig/sources/pyside2/libpyside/pysidesignal.cpp python3-pyside2-5.15.5/sources/pyside2/libpyside/pysidesignal.cpp
|
||||
--- python3-pyside2-5.15.5.orig/sources/pyside2/libpyside/pysidesignal.cpp 2023-09-27 21:52:01.387249407 -0400
|
||||
+++ python3-pyside2-5.15.5/sources/pyside2/libpyside/pysidesignal.cpp 2023-09-27 21:58:42.799610013 -0400
|
||||
@@ -49,6 +49,7 @@
|
||||
#include <QtCore/QMetaMethod>
|
||||
#include <QtCore/QMetaObject>
|
||||
#include <signature.h>
|
||||
+#include <basewrapper.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
@@ -670,7 +671,10 @@
|
||||
PyObject *value;
|
||||
PyObject *key;
|
||||
|
||||
- while (PyDict_Next(objType->tp_dict, &pos, &key, &value)) {
|
||||
+ Shiboken::Type::TypeDict tpDict(objType);
|
||||
+ Q_ASSERT(tpDict);
|
||||
+
|
||||
+ while (PyDict_Next(tpDict, &pos, &key, &value)) {
|
||||
if (PyObject_TypeCheck(value, PySideSignalTypeF())) {
|
||||
Shiboken::AutoDecRef signalInstance(reinterpret_cast<PyObject *>(PyObject_New(PySideSignalInstance, PySideSignalInstanceTypeF())));
|
||||
instanceInitialize(signalInstance.cast<PySideSignalInstance *>(), key, reinterpret_cast<PySideSignal *>(value), source, 0);
|
||||
diff -ur python3-pyside2-5.15.5.orig/sources/shiboken2/libshiboken/basewrapper.cpp python3-pyside2-5.15.5/sources/shiboken2/libshiboken/basewrapper.cpp
|
||||
--- python3-pyside2-5.15.5.orig/sources/shiboken2/libshiboken/basewrapper.cpp 2023-09-27 21:52:01.414249566 -0400
|
||||
+++ python3-pyside2-5.15.5/sources/shiboken2/libshiboken/basewrapper.cpp 2023-09-27 21:55:00.575303169 -0400
|
||||
@@ -1969,3 +1969,23 @@
|
||||
} // namespace Object
|
||||
|
||||
} // namespace Shiboken
|
||||
+
|
||||
+namespace Shiboken::Type
|
||||
+{
|
||||
+
|
||||
+TypeDict::TypeDict(PyTypeObject *t) noexcept :
|
||||
+ m_pyObj(t->tp_dict)
|
||||
+{
|
||||
+ if (m_pyObj == nullptr) {
|
||||
+ m_pyObj = PyObject_GenericGetDict(reinterpret_cast<PyObject *>(t), nullptr);
|
||||
+ m_owned = true;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+TypeDict::~TypeDict()
|
||||
+{
|
||||
+ if (m_owned)
|
||||
+ Py_DECREF(m_pyObj);
|
||||
+}
|
||||
+
|
||||
+} // namespace Shiboken::Type
|
||||
diff -ur python3-pyside2-5.15.5.orig/sources/shiboken2/libshiboken/basewrapper.h python3-pyside2-5.15.5/sources/shiboken2/libshiboken/basewrapper.h
|
||||
--- python3-pyside2-5.15.5.orig/sources/shiboken2/libshiboken/basewrapper.h 2023-09-27 21:52:01.416249578 -0400
|
||||
+++ python3-pyside2-5.15.5/sources/shiboken2/libshiboken/basewrapper.h 2023-09-27 21:54:17.907052245 -0400
|
||||
@@ -486,4 +486,33 @@
|
||||
|
||||
} // namespace Shiboken
|
||||
|
||||
+namespace Shiboken::Type
|
||||
+{
|
||||
+
|
||||
+/// TypeDict holds the tp_dict of a type. As of Python 3.12, tp_dict is nullptr,
|
||||
+/// so, PyObject_GenericGetDict() needs to be used and the reference managed.
|
||||
+/// FIXME: Replace by AutoDecRef when Python 3.12 is the minimum supported.
|
||||
+class LIBSHIBOKEN_API TypeDict
|
||||
+{
|
||||
+public:
|
||||
+ TypeDict(const TypeDict &) = delete;
|
||||
+ TypeDict(TypeDict &&) = delete;
|
||||
+ TypeDict &operator=(const TypeDict &) = delete;
|
||||
+ TypeDict &operator=(TypeDict &&) = delete;
|
||||
+
|
||||
+ explicit TypeDict(PyTypeObject *t) noexcept;
|
||||
+ ~TypeDict();
|
||||
+
|
||||
+ inline PyObject *object() { return m_pyObj; }
|
||||
+ inline operator PyObject *() { return m_pyObj; }
|
||||
+ inline operator bool() const { return m_pyObj != nullptr; }
|
||||
+ inline PyObject *operator->() { return m_pyObj; }
|
||||
+
|
||||
+private:
|
||||
+ PyObject *m_pyObj;
|
||||
+ bool m_owned = false;
|
||||
+};
|
||||
+
|
||||
+} // namespace Shiboken::Type
|
||||
+
|
||||
#endif // BASEWRAPPER_H
|
||||
diff -ur python3-pyside2-5.15.5.orig/sources/shiboken2/libshiboken/signature/signature_helper.cpp python3-pyside2-5.15.5/sources/shiboken2/libshiboken/signature/signature_helper.cpp
|
||||
--- python3-pyside2-5.15.5.orig/sources/shiboken2/libshiboken/signature/signature_helper.cpp 2023-09-27 21:52:01.417249584 -0400
|
||||
+++ python3-pyside2-5.15.5/sources/shiboken2/libshiboken/signature/signature_helper.cpp 2023-09-27 22:00:12.347136628 -0400
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "sbkstring.h"
|
||||
#include "sbkstaticstrings.h"
|
||||
#include "sbkstaticstrings_p.h"
|
||||
+#include "basewrapper.h"
|
||||
|
||||
#include "signature_p.h"
|
||||
|
||||
@@ -105,7 +106,8 @@
|
||||
*/
|
||||
assert(PyType_Check(type));
|
||||
PyType_Ready(type);
|
||||
- PyObject *dict = type->tp_dict;
|
||||
+ Shiboken::Type::TypeDict dict(type);
|
||||
+ assert(dict);
|
||||
for (; gsp->name != nullptr; gsp++) {
|
||||
PyObject *have_descr = PyDict_GetItemString(dict, gsp->name);
|
||||
if (have_descr != nullptr) {
|
||||
--- python3-pyside2-5.15.5.orig/sources/pyside2/PySide2/support/generate_pyi.py.orig 2023-09-27 22:20:58.761497093 -0400
|
||||
+++ python3-pyside2-5.15.5/sources/pyside2/PySide2/support/generate_pyi.py 2023-09-27 22:21:27.701667008 -0400
|
||||
@@ -113,9 +113,6 @@
|
||||
prefix = '~'
|
||||
return prefix + self.__name__
|
||||
"""
|
||||
- def _typevar__repr__(self):
|
||||
- return "typing." + self.__name__
|
||||
- typing.TypeVar.__repr__ = _typevar__repr__
|
||||
|
||||
# Adding a pattern to substitute "Union[T, NoneType]" by "Optional[T]"
|
||||
# I tried hard to replace typing.Optional by a simple override, but
|
|
@ -1,12 +1,12 @@
|
|||
# Template file for 'python3-pyside2'
|
||||
pkgname=python3-pyside2
|
||||
version=5.15.5
|
||||
revision=2
|
||||
version=5.15.10
|
||||
revision=1
|
||||
_pkgname="pyside-setup-opensource-src-${version}"
|
||||
build_wrksrc="sources/pyside2"
|
||||
build_style=cmake
|
||||
configure_args="-DPYTHON_EXECUTABLE=/usr/bin/python"
|
||||
hostmakedepends="cmake python3 shiboken2"
|
||||
hostmakedepends="python3-setuptools shiboken2"
|
||||
makedepends="python3-devel libshiboken2-devel qt5-devel
|
||||
qt5-multimedia-devel qt5-tools-devel qt5-plugin-mysql qt5-plugin-odbc
|
||||
qt5-plugin-pgsql qt5-plugin-sqlite qt5-plugin-tds qt5-x11extras-devel
|
||||
|
@ -23,7 +23,7 @@ maintainer="yopito <pierre.bourgin@free.fr>"
|
|||
license="LGPL-3.0-or-later"
|
||||
homepage="https://wiki.qt.io/Qt_for_Python"
|
||||
distfiles="https://download.qt.io/official_releases/QtForPython/pyside2/PySide2-${version}-src/${_pkgname}.tar.xz"
|
||||
checksum=3920a4fb353300260c9bc46ff70f1fb975c5e7efa22e9d51222588928ce19b33
|
||||
checksum=2af691d3613a41f83a60439b46568fc2c696dbfae42f7cd7b07152d115ead33a
|
||||
|
||||
build_options="webengine"
|
||||
desc_option_webengine="Build Qt5 WebEngine bindings"
|
||||
|
|
1
srcpkgs/shiboken2/patches/python3.12.patch
Symbolic link
1
srcpkgs/shiboken2/patches/python3.12.patch
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../python3-pyside2/patches/python3.12.patch
|
|
@ -1,11 +1,11 @@
|
|||
# Template file for 'shiboken2'
|
||||
pkgname=shiboken2
|
||||
version=5.15.7
|
||||
version=5.15.10
|
||||
revision=1
|
||||
_pkgname="pyside-setup-opensource-src-${version}"
|
||||
build_wrksrc="sources/shiboken2"
|
||||
build_style=cmake
|
||||
hostmakedepends="cmake python3-devel"
|
||||
hostmakedepends="python3-devel python3-setuptools"
|
||||
makedepends="python3-devel qt5-devel qt5-xmlpatterns-devel clang libxml2-devel
|
||||
libxslt-devel python3-numpy"
|
||||
depends="clang"
|
||||
|
@ -14,7 +14,7 @@ maintainer="yopito <pierre.bourgin@free.fr>"
|
|||
license="GPL-3.0-or-later"
|
||||
homepage="https://wiki.qt.io/Qt_for_Python/Shiboken"
|
||||
distfiles="https://download.qt.io/official_releases/QtForPython/pyside2/PySide2-${version}-src/${_pkgname}.tar.xz"
|
||||
checksum=f61210ae24e6882d5d0ca0059229e5dc4f35e2bca92dd6caf96c0f41943a8294
|
||||
checksum=2af691d3613a41f83a60439b46568fc2c696dbfae42f7cd7b07152d115ead33a
|
||||
|
||||
python_version=3
|
||||
export CLANG_INSTALL_DIR=${XBPS_CROSS_BASE}/usr
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue