guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch core-updates-frozen updated: gnu: python-poppler-qt5: Fix buildin


From: guix-commits
Subject: branch core-updates-frozen updated: gnu: python-poppler-qt5: Fix building.
Date: Sat, 06 Nov 2021 17:37:46 -0400

This is an automated email from the git hooks/post-receive script.

efraim pushed a commit to branch core-updates-frozen
in repository guix.

The following commit(s) were added to refs/heads/core-updates-frozen by this 
push:
     new dd87bbb  gnu: python-poppler-qt5: Fix building.
dd87bbb is described below

commit dd87bbb2b78b279248aaff15c0706fcd6d8cd7bb
Author: Efraim Flashner <efraim@flashner.co.il>
AuthorDate: Sat Nov 6 23:32:54 2021 +0200

    gnu: python-poppler-qt5: Fix building.
    
    * gnu/packages/pdf.scm (python-poppler-qt5)[source]: Add patch.
    * gnu/packages/patches/python-poppler-qt5-fix-build.patch: New file.
    * gnu/local.mk (dist_patch_DATA): Register it.
---
 gnu/local.mk                                       |   1 +
 .../patches/python-poppler-qt5-fix-build.patch     | 116 +++++++++++++++++++++
 gnu/packages/pdf.scm                               |   3 +-
 3 files changed, 119 insertions(+), 1 deletion(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index cca6ea2..26197c4 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1585,6 +1585,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/pthreadpool-system-libraries.patch      \
   %D%/packages/patches/python-chai-drop-python2.patch          \
   %D%/packages/patches/python-random2-getrandbits-test.patch           \
+  %D%/packages/patches/python-poppler-qt5-fix-build.patch      \
   %D%/packages/patches/sdcc-disable-non-free-code.patch                \
   %D%/packages/patches/sdl-pango-api_additions.patch           \
   %D%/packages/patches/sdl-pango-blit_overflow.patch           \
diff --git a/gnu/packages/patches/python-poppler-qt5-fix-build.patch 
b/gnu/packages/patches/python-poppler-qt5-fix-build.patch
new file mode 100644
index 0000000..099bb86
--- /dev/null
+++ b/gnu/packages/patches/python-poppler-qt5-fix-build.patch
@@ -0,0 +1,116 @@
+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 <code@bnavigator.de>
+Date: Thu, 4 Mar 2021 17:02:51 +0100
+Subject: [PATCH] map type QVector< QPair<TYPE, TYPE> > 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 <TYPE>
+ };
+ 
+ 
++/**
++ * Convert QVector< QPair<TYPE, TYPE> >
++ * from and to a Python list of a 2-item tuple
++ */
++
++template<TYPE>
++%MappedType QVector< QPair<TYPE, TYPE> >
++{
++%TypeHeaderCode
++#include <qvector.h>
++#include <qpair.h>
++%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<TYPE, TYPE>* p = new QPair<TYPE, TYPE>(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<TYPE, TYPE>");
++
++  // 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<TYPE, TYPE> > *qv = new QVector< QPair<TYPE, TYPE> >;
++
++  for (int i = 0; i < PySequence_Size(sipPy); ++i)
++  {
++    int state;
++    QPair<TYPE, TYPE> * p = reinterpret_cast< QPair<TYPE, TYPE> * 
>(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 9a63880..a251c8e 100644
--- a/gnu/packages/pdf.scm
+++ b/gnu/packages/pdf.scm
@@ -328,7 +328,8 @@ When present, Poppler is able to correctly render CJK and 
Cyrillic text.")
         (uri (pypi-uri "python-poppler-qt5" version))
         (sha256
          (base32
-          "0b82gm4i75q5v19kfbq0h4y0b2vcwr2213zkhxh6l0h45kdndmxd"))))
+          "0b82gm4i75q5v19kfbq0h4y0b2vcwr2213zkhxh6l0h45kdndmxd"))
+       (patches (search-patches "python-poppler-qt5-fix-build.patch"))))
     (build-system python-build-system)
     (arguments
      `(;; There are no tests.  The check phase just causes a rebuild.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]