From d99cec308c87c0bd8a5901d7a4a045bc54e902f7 Mon Sep 17 00:00:00 2001 From: Marco Rimoldi Date: Wed, 21 Feb 2024 20:30:32 +0100 Subject: gnu: python-poppler-qt5: Update to 21.3.0. * gnu/packages/pdf.scm (python-poppler-qt5): Update to 21.3.0. [build-system]: Change to pyproject. [inputs]: Change SIP to current version variant. * gnu/packages/patches/python-poppler-qt5-fix-build.patch: Delete file. * gnu/local.mk (dist_patch_DATA): De-register said patch. Change-Id: I30d6e2a3180505091d8072ed452211b0bb3a0178 Signed-off-by: Christopher Baines --- gnu/local.mk | 1 - .../patches/python-poppler-qt5-fix-build.patch | 116 --------------------- gnu/packages/pdf.scm | 49 +++------ 3 files changed, 17 insertions(+), 149 deletions(-) delete mode 100644 gnu/packages/patches/python-poppler-qt5-fix-build.patch diff --git a/gnu/local.mk b/gnu/local.mk index 4750cb290c..d57341f8bf 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1808,7 +1808,6 @@ dist_patch_DATA = \ %D%/packages/patches/python-feedparser-missing-import.patch \ %D%/packages/patches/python-louvain-fix-test.patch \ %D%/packages/patches/python-random2-getrandbits-test.patch \ - %D%/packages/patches/python-poppler-qt5-fix-build.patch \ %D%/packages/patches/python-pyreadstat-link-libiconv.patch \ %D%/packages/patches/python-pyls-black-41.patch \ %D%/packages/patches/python-pypdf-annotate-tests-appropriately.patch \ diff --git a/gnu/packages/patches/python-poppler-qt5-fix-build.patch b/gnu/packages/patches/python-poppler-qt5-fix-build.patch deleted file mode 100644 index 099bb86d2f..0000000000 --- a/gnu/packages/patches/python-poppler-qt5-fix-build.patch +++ /dev/null @@ -1,116 +0,0 @@ -Patch taken from the upstream repository -https://github.com/frescobaldi/python-poppler-qt5/issues/43 - -From 92e5962ec3751ab051d0b655fd61afc7a1cf709e Mon Sep 17 00:00:00 2001 -From: Ben Greiner -Date: Thu, 4 Mar 2021 17:02:51 +0100 -Subject: [PATCH] map type QVector< QPair > for - FormFieldChoice::choicesWithExportValues() (#45) - ---- - types.sip | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 93 insertions(+) - -diff --git a/types.sip b/types.sip -index 239b8c9..81cb283 100644 ---- a/types.sip -+++ b/types.sip -@@ -331,5 +331,98 @@ template - }; - - -+/** -+ * Convert QVector< QPair > -+ * from and to a Python list of a 2-item tuple -+ */ -+ -+template -+%MappedType QVector< QPair > -+{ -+%TypeHeaderCode -+#include -+#include -+%End -+ -+%ConvertFromTypeCode -+ // Create the list. -+ PyObject *l; -+ -+ if ((l = PyList_New(sipCpp->size())) == NULL) -+ return NULL; -+ -+ // Set the list elements. -+ for (int i = 0; i < sipCpp->size(); ++i) -+ { -+ QPair* p = new QPair(sipCpp->at(i)); -+ PyObject *ptuple = PyTuple_New(2); -+ PyObject *pfirst; -+ PyObject *psecond; -+ -+ TYPE *sfirst = new TYPE(p->first); -+ if ((pfirst = sipConvertFromType(sfirst, sipType_TYPE, sipTransferObj)) == NULL) -+ { -+ Py_DECREF(l); -+ Py_DECREF(ptuple); -+ return NULL; -+ } -+ PyTuple_SET_ITEM(ptuple, 0, pfirst); -+ -+ TYPE *ssecond = new TYPE(p->second); -+ if ((psecond = sipConvertFromType(ssecond, sipType_TYPE, sipTransferObj)) == NULL) -+ { -+ Py_DECREF(l); -+ Py_DECREF(ptuple); -+ Py_DECREF(pfirst); -+ return NULL; -+ } -+ PyTuple_SET_ITEM(ptuple, 1, psecond); -+ -+ PyList_SET_ITEM(l, i, ptuple); -+ } -+ -+ return l; -+%End -+ -+%ConvertToTypeCode -+ const sipTypeDef* qpair_type = sipFindType("QPair"); -+ -+ // Check the type if that is all that is required. -+ if (sipIsErr == NULL) -+ { -+ if (!PySequence_Check(sipPy)) -+ return 0; -+ -+ for (int i = 0; i < PySequence_Size(sipPy); ++i) -+ if (!sipCanConvertToType(PySequence_ITEM(sipPy, i), qpair_type, SIP_NOT_NONE)) -+ return 0; -+ -+ return 1; -+ } -+ -+ -+ QVector< QPair > *qv = new QVector< QPair >; -+ -+ for (int i = 0; i < PySequence_Size(sipPy); ++i) -+ { -+ int state; -+ QPair * p = reinterpret_cast< QPair * >(sipConvertToType(PySequence_ITEM(sipPy, i), qpair_type, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); -+ -+ if (*sipIsErr) -+ { -+ sipReleaseType(p, qpair_type, state); -+ delete qv; -+ return 0; -+ } -+ qv->append(*p); -+ sipReleaseType(p, qpair_type, state); -+ } -+ -+ *sipCppPtr = qv; -+ return sipGetState(sipTransferObj); -+%End -+ -+}; -+ - - /* kate: indent-width 4; space-indent on; hl c++; indent-mode cstyle; */ diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm index 22f6c8651f..47518e73d1 100644 --- a/gnu/packages/pdf.scm +++ b/gnu/packages/pdf.scm @@ -434,40 +434,25 @@ When present, Poppler is able to correctly render CJK and Cyrillic text.") (define-public python-poppler-qt5 (package (name "python-poppler-qt5") - (version "21.1.0") + (version "21.3.0") (source - (origin - (method url-fetch) - (uri (pypi-uri "python-poppler-qt5" version)) - (sha256 - (base32 - "0b82gm4i75q5v19kfbq0h4y0b2vcwr2213zkhxh6l0h45kdndmxd")) - (patches (search-patches "python-poppler-qt5-fix-build.patch")))) - (build-system python-build-system) + (origin + (method url-fetch) + (uri (pypi-uri "python-poppler-qt5" version)) + (sha256 + (base32 "1q3gvmsmsq3llf9mcbhlkryrgprqrw2z7wmnvagy180f3y2fhxxl")))) + (build-system pyproject-build-system) (arguments - `(;; There are no tests. The check phase just causes a rebuild. - #:tests? #f - #:phases - (modify-phases %standard-phases - (replace 'build - (lambda* (#:key inputs #:allow-other-keys) - (substitute* "setup.py" - ;; This check always fails, so disable it. - (("if not check_qtxml\\(\\)") - "if True")) - ;; We need to pass an extra flag here. This cannot be in - ;; configure-flags because it should not be passed for the - ;; installation phase. - ((@@ (guix build python-build-system) call-setuppy) - "build_ext" (list (string-append "--pyqt-sip-dir=" - (assoc-ref inputs "python-pyqt") - "/share/sip")) #t)))))) - (native-inputs - (list pkg-config)) - (inputs - (list python-sip-4 python-pyqt poppler-qt5 qtbase-5)) - (home-page "https://pypi.org/project/python-poppler-qt5/") - (synopsis "Python bindings for Poppler-Qt5") + `(;; The sipbuild.api backend builder expects a Python dictionary as per + ;; https://peps.python.org/pep-0517/#config-settings, but we + ;; give it lists and it fails. The next line is a workaround. + #:configure-flags '#nil + #:tests? #f)) + (native-inputs (list pkg-config)) + (inputs (list python-sip python-pyqt-builder python-pyqt poppler-qt5 + qtbase-5)) + (home-page "https://github.com/frescobaldi/python-poppler-qt5") + (synopsis "Python binding to Poppler-Qt5") (description "This package provides Python bindings for the Qt5 interface of the Poppler PDF rendering library.") -- cgit v1.2.3