From ad246e867a5455b9fee64f74db0e7de530d62393 Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Sat, 23 Sep 2023 21:02:52 -0400 Subject: [PATCH] scribus: rebuild for Python 3.12 --- srcpkgs/scribus/patches/python3.12.patch | 64 ++++++++++++++++++++++++ srcpkgs/scribus/template | 2 +- 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/scribus/patches/python3.12.patch diff --git a/srcpkgs/scribus/patches/python3.12.patch b/srcpkgs/scribus/patches/python3.12.patch new file mode 100644 index 00000000000..36f85f0eea9 --- /dev/null +++ b/srcpkgs/scribus/patches/python3.12.patch @@ -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; diff --git a/srcpkgs/scribus/template b/srcpkgs/scribus/template index 8a6f4085005..22630f13681 100644 --- a/srcpkgs/scribus/template +++ b/srcpkgs/scribus/template @@ -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"