This commit is contained in:
Gwyn Ciesla 2021-02-23 11:43:13 -06:00
parent fcae25e154
commit cc5bb2433f
5 changed files with 136 additions and 6 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/python-poppler-qt5-0.24.2.tar.gz
/python-poppler-qt5-0.74.0.tar.gz
/python-poppler-qt5-0.75.0.tar.gz
/python-poppler-qt5-21.1.0.tar.gz

View File

@ -0,0 +1,113 @@
From 40e71ad88173d02648bceb2438bc0567e60dacd5 Mon Sep 17 00:00:00 2001
From: Ben Greiner <code@bnavigator.de>
Date: Tue, 23 Feb 2021 17:59:33 +0100
Subject: [PATCH] map type QVector< QPair<TYPE, TYPE> > for
FormFieldChoice::choicesWithExportValues()
---
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; */

11
binpaths.patch Normal file
View File

@ -0,0 +1,11 @@
--- setup.py~ 2021-01-07 09:30:52.000000000 -0600
+++ setup.py 2021-02-23 11:32:14.766853522 -0600
@@ -138,7 +138,7 @@
def initialize_options (self):
build_ext_base.initialize_options(self)
self.poppler_version = None
- self.qmake_bin = 'qmake'
+ self.qmake_bin = 'qmake-qt5'
self.sip_bin = None
self.qt_include_dir = None
self.pyqt_sip_dir = None

View File

@ -1,16 +1,18 @@
Name: python3-poppler-qt5
Version: 0.75.0
Release: 7%{?dist}
Version: 21.1.0
Release: 1%{?dist}
Summary: Python bindings for the Poppler PDF rendering library
License: LGPLv2+
URL: https://github.com/frescobaldi/python-poppler-qt5
Source0: %{url}/archive/v%{version}.tar.gz#/python-poppler-qt5-%{version}.tar.gz
Patch0: binpaths.patch
Patch1: 40e71ad88173d02648bceb2438bc0567e60dacd5.patch
Requires: python3-qt5
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-qt5-devel
BuildRequires: python3-sip-devel >= 4.9.1
BuildRequires: python3-sip5
%{?_sip_api:Requires: python%{python3_pkgversion}-pyqt5-sip-api(%{_sip_api_major}) >= %{_sip_api}}
BuildRequires: pkgconfig(poppler-qt5)
@ -28,8 +30,8 @@ run programs written in Python 3 and using Poppler set.
%prep
%setup -qn python-poppler-qt5-%{version}
sed -i s/\'qmake\'/\'qmake-qt5\'/g setup.py
%patch0 -p0
%patch1 -p1
%build
%py3_build
@ -44,6 +46,9 @@ sed -i s/\'qmake\'/\'qmake-qt5\'/g setup.py
%{python3_sitearch}/python_poppler*
%changelog
* Tue Feb 23 2021 Gwyn Ciesla <gwync@protonmail.com> - 21.1.0-1
- 21.1.0
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.75.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

View File

@ -1 +1 @@
SHA512 (python-poppler-qt5-0.75.0.tar.gz) = 2f03036a2eaeb8e28875f19a813ff85a91c1e9a94301bdb736ecc50e7ececb4de2622728e6fecbf64e114435529f82b6afd23d772e2d3910ae03d5d2b5da3205
SHA512 (python-poppler-qt5-21.1.0.tar.gz) = ae2005cefaa7c26fef65cd9365ed9777e59dbbedc369416e418ea0eb2b3be28a95fc9e0718d7b191ff55fd7085946e36c32c3f5aa108f73ed4e10813103b0dcb