Skip to content

Commit

Permalink
py-{shiboken,pyside}: add py312 subport
Browse files Browse the repository at this point in the history
  • Loading branch information
erikbs committed Dec 20, 2023
1 parent 9cf831e commit ce7542b
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
6 changes: 5 additions & 1 deletion python/py-pyside/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}
Expand Down
17 changes: 17 additions & 0 deletions python/py-pyside/files/patch-py312-compatibility.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--- PySide/QtCore/typesystem_core_common.xml
+++ PySide/QtCore/typesystem_core_common.xml
@@ -201,12 +201,11 @@
</native-to-target>
<target-to-native>
<add-conversion type="PyUnicode">
- 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
</add-conversion>
<add-conversion type="PyString" check="py2kStrCheck(%in)">
6 changes: 5 additions & 1 deletion python/py-shiboken/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down
11 changes: 11 additions & 0 deletions python/py-shiboken/files/patch-py312-compatibility.diff
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit ce7542b

Please sign in to comment.