graphics/py-python-poppler-qt5: Update to 21.3.0

PR:		275494
Reported by:	wen@(via email)
Approved by:	portmgr(blanket)
This commit is contained in:
Wen Heping 2023-12-31 07:11:21 +00:00
parent 5d9e332009
commit 1e1cb652ce
8 changed files with 9 additions and 245 deletions

View file

@ -1,7 +1,6 @@
PORTNAME= python-poppler-qt5
DISTVERSIONPREFIX= v
DISTVERSION= 0.75.0
PORTREVISION= 27
DISTVERSION= 21.3.0
CATEGORIES= graphics python
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
@ -15,12 +14,12 @@ LICENSE_COMB= dual
BUILD_DEPENDS= qmake-qt5:devel/qt5-qmake
LIB_DEPENDS= libpoppler-qt5.so:graphics/poppler-qt5
USES= compiler:c++11-lang gl pkgconfig pyqt:5 python:3.8-3.9 qt:5
USES= compiler:c++11-lang gl pkgconfig pyqt:5 python qt:5
USE_GITHUB= yes
GH_ACCOUNT= frescobaldi
USE_GL= gl
USE_PYQT= pyqt5 sip:build
USE_PYTHON= flavors
USE_PYTHON= flavors pep517
USE_QT= core gui xml
PLIST_SUB= _PY_SONAME=${_PY_SONAME}

View file

@ -1,3 +1,3 @@
TIMESTAMP = 1587923266
SHA256 (frescobaldi-python-poppler-qt5-v0.75.0_GH0.tar.gz) = 92e6bd8f4ce90ba4e3e0c2ada026b643481ba1b109d45e8fdbdaedca8416a995
SIZE (frescobaldi-python-poppler-qt5-v0.75.0_GH0.tar.gz) = 23281
TIMESTAMP = 1703990050
SHA256 (frescobaldi-python-poppler-qt5-v21.3.0_GH0.tar.gz) = dbf3be9c8123429c8a73ebd4c18993331619198e88fa40dde99f48213fa75012
SIZE (frescobaldi-python-poppler-qt5-v21.3.0_GH0.tar.gz) = 25641

View file

@ -1,13 +0,0 @@
From https://github.com/frescobaldi/python-poppler-qt5/pull/41/commits/4ee58b6ee02772db915fdc5e70e336e0e5b2f34c
--- poppler-qt5.sip.orig 2019-11-22 05:56:45 UTC
+++ poppler-qt5.sip
@@ -19,7 +19,7 @@
#include <qt5/poppler-qt5.h>
%End
-%Include version.sip // auto-generated by the setup.py script
+%Include version.sip // auto-generated by the project.py script
%Include types.sip
%Include poppler-annotation.sip

View file

@ -1,94 +0,0 @@
From https://github.com/frescobaldi/python-poppler-qt5/pull/41/commits/4ee58b6ee02772db915fdc5e70e336e0e5b2f34c
--- project.py.orig 2020-10-11 18:59:42 UTC
+++ project.py
@@ -0,0 +1,89 @@
+"""The build configuration file for Python-Poppler-Qt5, used by sip."""
+
+from os.path import join
+import re
+import subprocess
+from pyqtbuild import PyQtBindings, PyQtProject
+from sipbuild import Option
+import PyQt5
+
+
+class PythonPopplerQt5(PyQtProject):
+ """The Project class."""
+
+ def __init__(self):
+ super().__init__()
+ self.bindings_factories = [PopplerQt5Bindings]
+
+ def update(self, tool):
+ """Allows SIP to find PyQt5 .sip files."""
+ super().update(tool)
+ self.sip_include_dirs.append(join(PyQt5.__path__[0], 'bindings'))
+
+
+class PopplerQt5Bindings(PyQtBindings):
+ """The Poppler-Qt5 Bindings class."""
+
+ def __init__(self, project):
+ super().__init__(project, name='Poppler-Qt5',
+ sip_file='poppler-qt5.sip',
+ qmake_QT=['xml'])
+
+ def get_options(self):
+ """Our custom options that a user can pass to sip-build."""
+ options = super().get_options()
+ options.append(
+ Option('poppler_version',
+ help='version of the poppler library',
+ metavar='VERSION'))
+ return options
+
+ @staticmethod
+ def run_pkg_config(option):
+ output = subprocess.check_output(
+ ['pkg-config', option, 'poppler-qt5'],
+ text=True)
+ return output.rstrip()
+
+ def apply_user_defaults(self, tool):
+ # Set include_dirs, library_dirs and libraries based on pkg-config data
+ cflags = self.run_pkg_config('--cflags-only-I').split()
+ libs = self.run_pkg_config('--libs').split()
+ self.include_dirs.extend(
+ flag[2:] for flag in cflags if flag.startswith('-I'))
+ self.library_dirs.extend(
+ flag[2:] for flag in libs if flag.startswith('-L'))
+ self.libraries.extend(
+ flag[2:] for flag in libs if flag.startswith('-l'))
+
+ # Generate version.sip file
+ if self.poppler_version is not None:
+ poppler_qt5_version = self.poppler_version
+ else:
+ poppler_qt5_version = self.run_pkg_config('--modversion')
+ poppler_qt5_version = tuple(map(int, poppler_qt5_version.split('.')))
+ python_poppler_qt5_version = self.project.version_str.split('.')
+ format_dict = {
+ 'vlen': 'i' * len(python_poppler_qt5_version),
+ 'vargs': ', '.join(python_poppler_qt5_version),
+ 'pvlen': 'i' * len(poppler_qt5_version),
+ 'pvargs': ', '.join(map(str, poppler_qt5_version)),
+ }
+ with open('version.sip.in') as template_file:
+ version_sip_template = template_file.read()
+ with open('version.sip', 'w') as version_file:
+ version_file.write(version_sip_template.format(**format_dict))
+
+ # Add Poppler version tag
+ if poppler_qt5_version:
+ with open('timeline.sip') as timeline_file:
+ timeline = timeline_file.read()
+ for match in re.finditer(r'POPPLER_V(\d+)_(\d+)_(\d+)', timeline):
+ if poppler_qt5_version < tuple(map(int, match.group(1, 2, 3))):
+ break
+ tag = match.group()
+ else:
+ tag = 'POPPLER_V0_20_0'
+ self.tags.append(tag)
+ self.tags.append("WS_X11")
+ super().apply_user_defaults(tool)

View file

@ -1,42 +0,0 @@
From https://github.com/frescobaldi/python-poppler-qt5/pull/41/commits/4ee58b6ee02772db915fdc5e70e336e0e5b2f34c
--- pyproject.toml.orig 2020-10-11 18:59:42 UTC
+++ pyproject.toml
@@ -0,0 +1,37 @@
+[build-system]
+requires = ["sip >=5", "PyQt-builder", "PyQt5"]
+build-backend = "sipbuild.api"
+
+[tool.sip.metadata]
+name = "python-poppler-qt5"
+version = "0.75.0"
+summary = "A Python binding to Poppler-Qt5"
+description-file = "README.rst"
+home-page = "https://github.com/frescobaldi/python-poppler-qt5"
+maintainer = "Wilbert Berendsen"
+maintainer-email = "wbsoft@xs4all.nl"
+license = "LGPL"
+classifier = [
+ "Development Status :: 5 - Production/Stable",
+ "Intended Audience :: Developers",
+ "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",
+ "Operating System :: MacOS :: MacOS X",
+ "Operating System :: Microsoft :: Windows",
+ "Operating System :: POSIX",
+ "Programming Language :: Python :: 3",
+ "Topic :: Multimedia :: Graphics :: Viewers"
+]
+requires-dist = "PyQt5"
+
+[tool.sip.project]
+sip-files-dir = "."
+sdist-excludes = [
+ "version.sip",
+ ".git/*",
+ ".git/*/*",
+ ".git/*/*/*",
+ ".git/*/*/*/*",
+ ".git/*/*/*/*/*",
+ ".git/*/*/*/*/*/*",
+ ".git/*/*/*/*/*/*/*"
+]

View file

@ -1,60 +0,0 @@
From https://github.com/frescobaldi/python-poppler-qt5/pull/33/commits/6cc4d83b172ffb2d206e696ce508e508cd46b7c3
--- types.sip.orig 2019-11-22 05:56:45 UTC
+++ types.sip
@@ -182,7 +182,7 @@ template <TYPE>
if ((l = PyList_New(sipCpp->size())) == NULL)
return NULL;
- const sipMappedType* qlinkedlist_type = sipFindMappedType("QLinkedList<TYPE>");
+ const sipTypeDef* qlinkedlist_type = sipFindType("QLinkedList<TYPE>");
// Set the list elements.
for (int i = 0; i < sipCpp->size(); ++i)
@@ -190,7 +190,7 @@ template <TYPE>
QLinkedList<TYPE>* t = new QLinkedList<TYPE>(sipCpp->at(i));
PyObject *tobj;
- if ((tobj = sipConvertFromMappedType(t, qlinkedlist_type, sipTransferObj)) == NULL)
+ if ((tobj = sipConvertFromType(t, qlinkedlist_type, sipTransferObj)) == NULL)
{
Py_DECREF(l);
delete t;
@@ -203,7 +203,7 @@ template <TYPE>
%End
%ConvertToTypeCode
- const sipMappedType* qlinkedlist_type = sipFindMappedType("QLinkedList<TYPE>");
+ const sipTypeDef* qlinkedlist_type = sipFindType("QLinkedList<TYPE>");
// Check the type if that is all that is required.
if (sipIsErr == NULL)
@@ -212,7 +212,7 @@ template <TYPE>
return 0;
for (int i = 0; i < PySequence_Size(sipPy); ++i)
- if (!sipCanConvertToMappedType(PySequence_ITEM(sipPy, i), qlinkedlist_type, SIP_NOT_NONE))
+ if (!sipCanConvertToType(PySequence_ITEM(sipPy, i), qlinkedlist_type, SIP_NOT_NONE))
return 0;
return 1;
@@ -224,16 +224,16 @@ template <TYPE>
for (int i = 0; i < PySequence_Size(sipPy); ++i)
{
int state;
- QLinkedList<TYPE> * t = reinterpret_cast< QLinkedList<TYPE> * >(sipConvertToMappedType(PySequence_ITEM(sipPy, i), qlinkedlist_type, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
+ QLinkedList<TYPE> * t = reinterpret_cast< QLinkedList<TYPE> * >(sipConvertToType(PySequence_ITEM(sipPy, i), qlinkedlist_type, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
if (*sipIsErr)
{
- sipReleaseInstance(t, sipClass_TYPE, state);
+ sipReleaseType(t, qlinkedlist_type, state);
delete ql;
return 0;
}
ql->append(*t);
- sipReleaseInstance(t, sipClass_TYPE, state);
+ sipReleaseType(t, qlinkedlist_type, state);
}
*sipCppPtr = ql;

View file

@ -1,26 +0,0 @@
From https://github.com/frescobaldi/python-poppler-qt5/pull/41/commits/4ee58b6ee02772db915fdc5e70e336e0e5b2f34c
--- version.sip.in.orig 2020-10-11 18:59:42 UTC
+++ version.sip.in
@@ -0,0 +1,21 @@
+// Generated by project.py -- Do not edit
+
+PyObject *version();
+%Docstring
+The version of the popplerqt5 python module.
+%End
+
+PyObject *poppler_version();
+%Docstring
+The version of the Poppler library it was built with.
+%End
+
+%ModuleCode
+
+PyObject *version()
+{{ return Py_BuildValue("({vlen})", {vargs}); }};
+
+PyObject *poppler_version()
+{{ return Py_BuildValue("({pvlen})", {pvargs}); }};
+
+%End

View file

@ -21,6 +21,6 @@
%%PYTHON_SITELIBDIR%%/PyQt5/bindings/popplerqt5/version.sip
%%PYTHON_SITELIBDIR%%/popplerqt5%%_PY_SONAME%%.so
%%PYTHON_SITELIBDIR%%/popplerqt5.so
%%PYTHON_SITELIBDIR%%/python_poppler_qt5-0.75.0.dist-info/INSTALLER
%%PYTHON_SITELIBDIR%%/python_poppler_qt5-0.75.0.dist-info/METADATA
%%PYTHON_SITELIBDIR%%/python_poppler_qt5-0.75.0.dist-info/RECORD
%%PYTHON_SITELIBDIR%%/python_poppler_qt5-21.3.0.dist-info/INSTALLER
%%PYTHON_SITELIBDIR%%/python_poppler_qt5-21.3.0.dist-info/METADATA
%%PYTHON_SITELIBDIR%%/python_poppler_qt5-21.3.0.dist-info/RECORD