mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-22 19:44:21 +01:00
python/python-poppler-qt5: Added (Python bindings to poppler-qt5).
Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
This commit is contained in:
parent
3dd2858750
commit
e51ab0068f
5 changed files with 235 additions and 0 deletions
|
@ -0,0 +1,113 @@
|
|||
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; */
|
2
python/python-poppler-qt5/README
Normal file
2
python/python-poppler-qt5/README
Normal file
|
@ -0,0 +1,2 @@
|
|||
A Python binding to libpoppler-qt5 that aims for completeness and for
|
||||
being actively maintained.
|
91
python/python-poppler-qt5/python-poppler-qt5.SlackBuild
Normal file
91
python/python-poppler-qt5/python-poppler-qt5.SlackBuild
Normal file
|
@ -0,0 +1,91 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Slackware build script for python-poppler-qt5
|
||||
|
||||
# Copyright 2021 Matteo Bernardini <ponce@slackbuilds.org>, Pisa, Italy
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use of this script, with or without modification, is
|
||||
# permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of this script must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
PRGNAM=python-poppler-qt5
|
||||
VERSION=${VERSION:-21.1.0}
|
||||
BUILD=${BUILD:-1}
|
||||
TAG=${TAG:-_SBo}
|
||||
|
||||
if [ -z "$ARCH" ]; then
|
||||
case "$( uname -m )" in
|
||||
i?86) ARCH=i586 ;;
|
||||
arm*) ARCH=arm ;;
|
||||
*) ARCH=$( uname -m ) ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
CWD=$(pwd)
|
||||
TMP=${TMP:-/tmp/SBo}
|
||||
PKG=$TMP/package-$PRGNAM
|
||||
OUTPUT=${OUTPUT:-/tmp}
|
||||
|
||||
if [ "$ARCH" = "i586" ]; then
|
||||
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
|
||||
LIBDIRSUFFIX=""
|
||||
elif [ "$ARCH" = "i686" ]; then
|
||||
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
||||
LIBDIRSUFFIX=""
|
||||
elif [ "$ARCH" = "x86_64" ]; then
|
||||
SLKCFLAGS="-O2 -fPIC"
|
||||
LIBDIRSUFFIX="64"
|
||||
else
|
||||
SLKCFLAGS="-O2"
|
||||
LIBDIRSUFFIX=""
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
rm -rf $PKG
|
||||
mkdir -p $TMP $PKG $OUTPUT
|
||||
cd $TMP
|
||||
rm -rf $PRGNAM-$VERSION
|
||||
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
|
||||
cd $PRGNAM-$VERSION
|
||||
chown -R root:root .
|
||||
find -L . \
|
||||
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
|
||||
-o -perm 511 \) -exec chmod 755 {} \; -o \
|
||||
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
|
||||
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
|
||||
|
||||
patch -p1 < $CWD/92e5962ec3751ab051d0b655fd61afc7a1cf709e.patch
|
||||
|
||||
#sed -i "s|self.sip_bin\ =\ None|self.sip_bin = '/usr/bin/sip3'|" setup.py
|
||||
|
||||
python3 setup.py install --root $PKG
|
||||
|
||||
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
|
||||
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
||||
|
||||
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
||||
cp -a \
|
||||
ChangeLog README.rst TODO LICENSE \
|
||||
$PKG/usr/doc/$PRGNAM-$VERSION
|
||||
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
||||
|
||||
mkdir -p $PKG/install
|
||||
cat $CWD/slack-desc > $PKG/install/slack-desc
|
||||
|
||||
cd $PKG
|
||||
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|
10
python/python-poppler-qt5/python-poppler-qt5.info
Normal file
10
python/python-poppler-qt5/python-poppler-qt5.info
Normal file
|
@ -0,0 +1,10 @@
|
|||
PRGNAM="python-poppler-qt5"
|
||||
VERSION="21.1.0"
|
||||
HOMEPAGE="https://github.com/wbsoft/python-poppler-qt5"
|
||||
DOWNLOAD="http://ponce.cc/slackware/sources/repo/python-poppler-qt5-21.1.0.tar.gz"
|
||||
MD5SUM="0225ff40fba3662e3d437bf48ae47d06"
|
||||
DOWNLOAD_x86_64=""
|
||||
MD5SUM_x86_64=""
|
||||
REQUIRES=""
|
||||
MAINTAINER="Matteo Bernardini"
|
||||
EMAIL="ponce@slackbuilds.org"
|
19
python/python-poppler-qt5/slack-desc
Normal file
19
python/python-poppler-qt5/slack-desc
Normal file
|
@ -0,0 +1,19 @@
|
|||
# HOW TO EDIT THIS FILE:
|
||||
# The "handy ruler" below makes it easier to edit a package description.
|
||||
# Line up the first '|' above the ':' following the base package name, and
|
||||
# the '|' on the right side marks the last column you can put a character in.
|
||||
# You must make exactly 11 lines for the formatting to be correct. It's also
|
||||
# customary to leave one space after the ':' except on otherwise blank lines.
|
||||
|
||||
|-----handy-ruler------------------------------------------------------|
|
||||
python-poppler-qt5: python-poppler-qt5 (Python bindings to poppler-qt5)
|
||||
python-poppler-qt5:
|
||||
python-poppler-qt5: A Python binding to libpoppler-qt5 that aims for completeness
|
||||
python-poppler-qt5: and for being actively maintained.
|
||||
python-poppler-qt5:
|
||||
python-poppler-qt5: homepage: https://github.com/frescobaldi/python-poppler-qt5
|
||||
python-poppler-qt5:
|
||||
python-poppler-qt5:
|
||||
python-poppler-qt5:
|
||||
python-poppler-qt5:
|
||||
python-poppler-qt5:
|
Loading…
Reference in a new issue