scribus: rebuild for Python 3.12

This commit is contained in:
Andrew J. Hesford 2023-09-23 21:02:52 -04:00
parent df93fe4619
commit ad246e867a
2 changed files with 65 additions and 1 deletions

View file

@ -0,0 +1,64 @@
--- ./scribus/plugins/scriptplugin/cmdgetsetprop.cpp.orig 2023-09-28 09:13:21.384565229 -0400
+++ ./scribus/plugins/scriptplugin/cmdgetsetprop.cpp 2023-09-28 09:21:08.298879558 -0400
@@ -409,10 +409,10 @@
success = obj->setProperty(propertyName, QString::fromUtf8(PyBytes_AsString(objValue)));
else if (PyUnicode_Check(objValue))
{
- // Get a pointer to the internal buffer of the Py_Unicode object, which is UCS2 formatted
- const unsigned short * ucs2Data = (const unsigned short *) PyUnicode_AS_UNICODE(objValue);
- // and make a new QString from it (the string is copied)
- success = obj->setProperty(propertyName, QString::fromUtf16(ucs2Data));
+ // Get the data as a wchar_t array and copy to a QString
+ Py_ssize_t wcsize = 0;
+ const wchar_t * const wcdata = PyUnicode_AsWideCharString(objValue, &wcsize);
+ success = obj->setProperty(propertyName, QString::fromWCharArray(wcdata, wcsize));
}
else
matched = false;
@@ -429,10 +429,10 @@
}
else if (PyUnicode_Check(objValue))
{
- // Get a pointer to the internal buffer of the Py_Unicode object, which is UCS2 formatted
- const unsigned short * utf16Data = (const unsigned short *)PyUnicode_AS_UNICODE(objValue);
- // and make a new QString from it (the string is copied)
- success = obj->setProperty(propertyName, QString::fromUtf16(utf16Data).toLatin1());
+ // Get the data as a wchar_t array and copy to a QString
+ Py_ssize_t wcsize = 0;
+ const wchar_t * const wcdata = PyUnicode_AsWideCharString(objValue, &wcsize);
+ success = obj->setProperty(propertyName, QString::fromWCharArray(wcdata, wcsize));
}
else
matched = false;
--- ./scribus/plugins/scriptplugin_py2x/cmdgetsetprop.cpp.orig 2023-09-28 09:13:07.372484278 -0400
+++ ./scribus/plugins/scriptplugin_py2x/cmdgetsetprop.cpp 2023-09-28 09:22:02.366125450 -0400
@@ -406,10 +406,10 @@
success = obj->setProperty(propertyName, QString::fromUtf8(PyString_AsString(objValue)));
else if (PyUnicode_Check(objValue))
{
- // Get a pointer to the internal buffer of the Py_Unicode object, which is UCS2 formatted
- const unsigned short * ucs2Data = (const unsigned short *)PyUnicode_AS_UNICODE(objValue);
- // and make a new QString from it (the string is copied)
- success = obj->setProperty(propertyName, QString::fromUtf16(ucs2Data));
+ // Get the data as a wchar_t array and copy to a QString
+ Py_ssize_t wcsize = 0;
+ const wchar_t * const wcdata = PyUnicode_AsWideCharString(objValue, &wcsize);
+ success = obj->setProperty(propertyName, QString::fromWCharArray(wcdata, wcsize));
}
else
matched = false;
@@ -426,10 +426,10 @@
}
else if (PyUnicode_Check(objValue))
{
- // Get a pointer to the internal buffer of the Py_Unicode object, which is UCS2 formatted
- const unsigned short * utf16Data = (const unsigned short *)PyUnicode_AS_UNICODE(objValue);
- // and make a new QString from it (the string is copied)
- success = obj->setProperty(propertyName, QString::fromUtf16(utf16Data).toLatin1());
+ // Get the data as a wchar_t array and copy to a QString
+ Py_ssize_t wcsize = 0;
+ const wchar_t * const wcdata = PyUnicode_AsWideCharString(objValue, &wcsize);
+ success = obj->setProperty(propertyName, QString::fromWCharArray(wcdata, wcsize));
}
else
matched = false;

View file

@ -1,7 +1,7 @@
# Template file for 'scribus'
pkgname=scribus
version=1.5.8
revision=10
revision=11
build_style=cmake
configure_args="-DCMAKE_SKIP_RPATH=TRUE -DQT_PREFIX=${XBPS_CROSS_BASE}/usr
-DWANT_GRAPHICSMAGICK=1 -DWANT_CPP17=ON"