diff options
Diffstat (limited to 'graphics/py-python-poppler-qt5/files')
5 files changed, 235 insertions, 0 deletions
diff --git a/graphics/py-python-poppler-qt5/files/patch-poppler-qt5.sip b/graphics/py-python-poppler-qt5/files/patch-poppler-qt5.sip new file mode 100644 index 000000000000..8ba76f442ddf --- /dev/null +++ b/graphics/py-python-poppler-qt5/files/patch-poppler-qt5.sip @@ -0,0 +1,13 @@ +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 diff --git a/graphics/py-python-poppler-qt5/files/patch-project.py b/graphics/py-python-poppler-qt5/files/patch-project.py new file mode 100644 index 000000000000..dc3e0ad077dd --- /dev/null +++ b/graphics/py-python-poppler-qt5/files/patch-project.py @@ -0,0 +1,94 @@ +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) diff --git a/graphics/py-python-poppler-qt5/files/patch-pyproject.toml b/graphics/py-python-poppler-qt5/files/patch-pyproject.toml new file mode 100644 index 000000000000..7ef45522bdba --- /dev/null +++ b/graphics/py-python-poppler-qt5/files/patch-pyproject.toml @@ -0,0 +1,42 @@ +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/*/*/*/*/*/*/*" ++] diff --git a/graphics/py-python-poppler-qt5/files/patch-types.sip b/graphics/py-python-poppler-qt5/files/patch-types.sip new file mode 100644 index 000000000000..736b40fad956 --- /dev/null +++ b/graphics/py-python-poppler-qt5/files/patch-types.sip @@ -0,0 +1,60 @@ +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; diff --git a/graphics/py-python-poppler-qt5/files/patch-version.sip.in b/graphics/py-python-poppler-qt5/files/patch-version.sip.in new file mode 100644 index 000000000000..e09774be5c66 --- /dev/null +++ b/graphics/py-python-poppler-qt5/files/patch-version.sip.in @@ -0,0 +1,26 @@ +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 |