From ce7542b2e15b54ecfbbc0dbf2f006d4f39c1e3e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Br=C3=A5then=20Solem?= Date: Wed, 20 Dec 2023 22:31:30 +0100 Subject: [PATCH] py-{shiboken,pyside}: add py312 subport --- python/py-pyside/Portfile | 6 +++++- .../files/patch-py312-compatibility.diff | 17 +++++++++++++++++ python/py-shiboken/Portfile | 6 +++++- .../files/patch-py312-compatibility.diff | 11 +++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 python/py-pyside/files/patch-py312-compatibility.diff create mode 100644 python/py-shiboken/files/patch-py312-compatibility.diff diff --git a/python/py-pyside/Portfile b/python/py-pyside/Portfile index 198844e13599e..dd345a91340e5 100644 --- a/python/py-pyside/Portfile +++ b/python/py-pyside/Portfile @@ -8,7 +8,7 @@ github.setup pyside PySide 1.2.4 name py-pyside revision 0 set qt.ver 4.8 -python.versions 27 37 38 39 310 311 +python.versions 27 37 38 39 310 311 312 categories-append devel maintainers nomaintainer license LGPL @@ -34,6 +34,10 @@ if {${name} ne ${subport}} { patchfiles-append \ patch-py311-compatibility.diff } + if {${python.version} >= 312} { + patchfiles-append \ + patch-py312-compatibility.diff + } depends_lib-append port:py${python.version}-shiboken use_configure yes configure.env-append CMAKE_PREFIX_PATH=${python.prefix} diff --git a/python/py-pyside/files/patch-py312-compatibility.diff b/python/py-pyside/files/patch-py312-compatibility.diff new file mode 100644 index 0000000000000..a5db6804498b9 --- /dev/null +++ b/python/py-pyside/files/patch-py312-compatibility.diff @@ -0,0 +1,17 @@ +--- PySide/QtCore/typesystem_core_common.xml ++++ PySide/QtCore/typesystem_core_common.xml +@@ -201,12 +201,11 @@ + + + +- Py_UNICODE* unicode = PyUnicode_AS_UNICODE(%in); + #if defined(Py_UNICODE_WIDE) + // cast as Py_UNICODE can be a different type +- %out = QString::fromUcs4((const uint*)unicode); ++ %out = QString::fromUcs4((const uint*)PyUnicode_4BYTE_DATA(%in)); + #else +- %out = QString::fromUtf16((const ushort*)unicode, PyUnicode_GET_SIZE(%in)); ++ %out = QString::fromUtf16((const ushort*)PyUnicode_2BYTE_DATA(%in), PyUnicode_GET_SIZE(%in)); + #endif + + diff --git a/python/py-shiboken/Portfile b/python/py-shiboken/Portfile index a0068fe7d336a..840945246556d 100644 --- a/python/py-shiboken/Portfile +++ b/python/py-shiboken/Portfile @@ -7,7 +7,7 @@ PortGroup github 1.0 github.setup pyside Shiboken 1.2.4 name py-shiboken revision 2 -python.versions 27 35 36 37 38 39 310 311 +python.versions 27 35 36 37 38 39 310 311 312 categories-append devel maintainers nomaintainer license LGPL @@ -39,6 +39,10 @@ if {${name} ne ${subport}} { patchfiles-append \ patch-py311-compatibility.diff } + if {${python.version} >= 312} { + patchfiles-append \ + patch-py312-compatibility.diff + } depends_lib-append port:python${python.version} \ port:libxslt \ diff --git a/python/py-shiboken/files/patch-py312-compatibility.diff b/python/py-shiboken/files/patch-py312-compatibility.diff new file mode 100644 index 0000000000000..511cb1128bef3 --- /dev/null +++ b/python/py-shiboken/files/patch-py312-compatibility.diff @@ -0,0 +1,11 @@ +--- libshiboken/sbkstring.cpp ++++ libshiboken/sbkstring.cpp +@@ -173,7 +173,7 @@ Py_ssize_t len(PyObject* str) + return 0; + + if (PyUnicode_Check(str)) +- return PyUnicode_GET_SIZE(str); ++ return PyUnicode_GetLength(str); + + if (PyBytes_Check(str)) + return PyBytes_GET_SIZE(str);