summaryrefslogtreecommitdiff
path: root/app-text/paperwork-backend
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-02-04 23:42:56 +0000
committerV3n3RiX <venerix@koprulu.sector>2024-02-04 23:42:56 +0000
commit7b43cd44c0c26cd9e0ae1dcd94596667cb119ee6 (patch)
tree9715703a1ec2185bfa303bd2d2b04e560654f72a /app-text/paperwork-backend
parent27ad6a285576ce16e4c74d806efee77166f0c3c6 (diff)
gentoo auto-resync : 04:02:2024 - 23:42:56
Diffstat (limited to 'app-text/paperwork-backend')
-rw-r--r--app-text/paperwork-backend/Manifest2
-rw-r--r--app-text/paperwork-backend/files/paperwork-backend-2.2.1-cairo_workaround.patch52
-rw-r--r--app-text/paperwork-backend/paperwork-backend-2.2.1-r1.ebuild63
3 files changed, 117 insertions, 0 deletions
diff --git a/app-text/paperwork-backend/Manifest b/app-text/paperwork-backend/Manifest
index efc6905cda5a..25f7cceb7a27 100644
--- a/app-text/paperwork-backend/Manifest
+++ b/app-text/paperwork-backend/Manifest
@@ -1,6 +1,8 @@
+AUX paperwork-backend-2.2.1-cairo_workaround.patch 2028 BLAKE2B 4b7074165c3761427f667e81f843b4a680878406f5a79ebb8733b5bb9ff5ea45c5fe836531a742d303981c52eb3b122aec5dea07522226c48b969d8f0fde2327 SHA512 d5790b96c3745c769cc3296d24399c21f2a6a864beb188105fb27c407b3739661943aa9ef706ca95d97f08ecb6d6cb0e9b1ec1a8c00093434a96913f8eeb5849
DIST paperwork-2.2.1.tar.bz2 2529505 BLAKE2B e5545d3fbb5e41d0ddd21a0358fae496d127b30a3f72e1438eef679c520a3152e4db006d9dc42023431907281452931e90aea187c4928309bde7add2d54b5844 SHA512 f96ddf3efe3b5021e612600fa2e3a9c83db7ec78b9637e434facefcc422700be1b67b74231b4738a7762905ac5267f412839ff9d43cb9dcf7f95a5f3d6f7091f
DIST paperwork-backend-2.1.2.tar.gz 1346499 BLAKE2B daf8c6dee97b0bdf814bcf7e9c83a80ab878250994a770f5fa6be4c0b4e23f0def51e22c0a8652a19e9294f3fab0b522b25c2a91c306ad760d568faf76a78610 SHA512 0156baa658a9fe26680bf6d146af3f03b98da307ee1cfaf4803f8b70a2ffdb0010fe23c4d4f9b5a572919c4be94a1aad4fd070220849248cdb18c5b1c4bc478b
DIST paperwork-data-2.2.1.tar.gz 5210355 BLAKE2B 48ee8f9828f7aed9b41c998c2cdc43a2b98c2a2482e388500b8d04867a450bbf3264ef5a87d7f215f1389943e4cbab452d3a7a6235d63cfdb27127ab56ad9c2f SHA512 cf663368f733f45dde8242c3ad9ba405361628bddb7e8aed9dffeb5bb86c1abac7a3485cb7e2042d65006f8f336390fa81ea182dad62f4259b79805ac7a0416b
EBUILD paperwork-backend-2.1.2.ebuild 1317 BLAKE2B 1cd4f19bdd2c9ebd2808ec4a98e9dcc367be5061ff439019894e722f13d39bd5eeed39a21bcfc34fee76d931fc59227cc53693b5a02a083eb55e4d562fc1621a SHA512 517e128b5eb38752eb173a308ec4f898d1a40de714c9349c8f0553bf416dd411b87fc6071fae196437a91ee6099db9cd0ef786d7efc3fe7289025f007df23c6b
+EBUILD paperwork-backend-2.2.1-r1.ebuild 1673 BLAKE2B 8e7aea02b94811ed3b7d70e3981ce0aff16e2ccf68fb73498ebb69309a04fb33d287eed040832397bc4bc0d3e689f1ac459cefb336a354d06f9273e7f5912cd5 SHA512 b37dca8cb31037454391c58dec1cbde20e34a821f0e16e8b3e85a30b48f8017720bb08b59081fd920830ca67032b4556062ce027c09289e91026f7b485f3d0e2
EBUILD paperwork-backend-2.2.1.ebuild 1639 BLAKE2B 69995b3643e868ead1d8a266d9d3d9d1f427f015b91a6ef3e27d48398fae400f3896bf73c672d47c15c2cba577df82e5d155be78c874017fd7f178e26e654141 SHA512 fd6745e7d56695ef600219a5ca2bb0fafa5563a8da643eee86bdecb2f8f61951d750d313e15329fa285c9f6ce04fca366954fad87f4f6b30d3024cd10e1c031e
MISC metadata.xml 410 BLAKE2B c6ed41347886699086f69694dbaa5134e9ebfb02cbc157909e02971cce01cc562e82f31c15bb5ae1ee261d79d6e5a9ece81c1cf7fa48a9839ddf467c06fab392 SHA512 01bf86e9c8fd1b9e1d514edca46992609eb8789fe95ea914914ef4fc43c7b3f0fcaffaa712bb5c72e3936679b44749837b0ba73c2b62c1b0bc52f318fcc8e31f
diff --git a/app-text/paperwork-backend/files/paperwork-backend-2.2.1-cairo_workaround.patch b/app-text/paperwork-backend/files/paperwork-backend-2.2.1-cairo_workaround.patch
new file mode 100644
index 000000000000..01eb2a6154b0
--- /dev/null
+++ b/app-text/paperwork-backend/files/paperwork-backend-2.2.1-cairo_workaround.patch
@@ -0,0 +1,52 @@
+From c9430b844fbcedc9119e3d464f5f0c85feb7b197 Mon Sep 17 00:00:00 2001
+From: Jerome Flesch <jflesch@openpaper.work>
+Date: Sun, 4 Feb 2024 20:33:27 +0100
+Subject: [PATCH] Backend/docexport PDF: Workaround Cairo bug that causes
+ occasional crashes when exporting to generated PDF.
+
+Closes #942
+---
+ .../src/paperwork_backend/docexport/pdf.py | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/paperwork-backend/src/paperwork_backend/docexport/pdf.py b/paperwork-backend/src/paperwork_backend/docexport/pdf.py
+index 160e60710..befded73c 100644
+--- a/paperwork-backend/src/paperwork_backend/docexport/pdf.py
++++ b/paperwork-backend/src/paperwork_backend/docexport/pdf.py
+@@ -115,6 +115,8 @@ class PdfCreator(object):
+ )
+ self.pdf_context = cairo.Context(self.pdf_surface)
+
++ self.gc_protection = [] # WORKAROUND(Jflesch): Cairo crash
++
+ def set_page_size(self, img_size):
+ # portrait or landscape
+ if (img_size[0] < img_size[1]):
+@@ -187,6 +189,16 @@ class PdfCreator(object):
+ "pillow_to_surface", img,
+ intermediate="jpeg", quality=int(self.quality * 100)
+ )
++ # WORKAROUND(Jflesch):
++ # If Cairo supports JPEG embedding, we use
++ # cairo.ImageSurface.set_mime_data() instead of the usual Cairo
++ # surface functions to draw the image. It seems this function does
++ # not increment the ref counter of the surface object
++ # --> the Python GC tends to collect it while Cairo is still going
++ # to use it to generate the PDF.
++ # --> we have to keep a reference on it ourselves, until the page has
++ # been generated.
++ self.gc_protection.append(img_surface)
+
+ self.pdf_context.save()
+ try:
+@@ -199,6 +211,7 @@ class PdfCreator(object):
+
+ def next_page(self):
+ self.pdf_context.show_page()
++ self.gc_protection = [] # WORKAROUND(Jflesch): Cairo crash
+
+ def finish(self):
+ self.pdf_surface.flush()
+--
+GitLab
+
diff --git a/app-text/paperwork-backend/paperwork-backend-2.2.1-r1.ebuild b/app-text/paperwork-backend/paperwork-backend-2.2.1-r1.ebuild
new file mode 100644
index 000000000000..bb7a9c75061b
--- /dev/null
+++ b/app-text/paperwork-backend/paperwork-backend-2.2.1-r1.ebuild
@@ -0,0 +1,63 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{9..12} )
+
+inherit distutils-r1
+
+DESCRIPTION="Backend part of Paperwork (Python API, no UI)"
+HOMEPAGE="https://gitlab.gnome.org/World/OpenPaperwork"
+# Update from release hash at:
+# https://gitlab.gnome.org/World/OpenPaperwork/paperwork/-/tags
+REL_HASH="0bea4054"
+SRC_URI="https://gitlab.gnome.org/World/OpenPaperwork/paperwork/-/archive/${PV}/paperwork-${PV}.tar.bz2
+ https://download.openpaper.work/data/paperwork/master_${REL_HASH}/data.tar.gz -> paperwork-data-${PV}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+RDEPEND="
+ app-text/openpaperwork-core[${PYTHON_USEDEP}]
+ app-text/openpaperwork-gtk[${PYTHON_USEDEP}]
+ app-text/poppler[introspection]
+ dev-python/distro[${PYTHON_USEDEP}]
+ dev-python/pillow[${PYTHON_USEDEP}]
+ dev-python/psutil[${PYTHON_USEDEP}]
+ dev-python/pycairo[${PYTHON_USEDEP}]
+ dev-python/pycountry[${PYTHON_USEDEP}]
+ dev-python/pygobject:3[${PYTHON_USEDEP}]
+ dev-python/termcolor[${PYTHON_USEDEP}]
+ dev-python/whoosh[${PYTHON_USEDEP}]
+ sci-libs/scikit-learn[${PYTHON_USEDEP}]
+"
+BDEPEND="
+ ${RDEPEND}
+ dev-python/setuptools-scm[${PYTHON_USEDEP}]
+ sys-apps/which
+ sys-devel/gettext
+ test? (
+ dev-python/libpillowfight[${PYTHON_USEDEP}]
+ media-libs/libinsane
+ )
+"
+S=${WORKDIR}/paperwork-${PV}/${PN}
+
+distutils_enable_tests unittest
+
+export SETUPTOOLS_SCM_PRETEND_VERSION=${PV}
+
+src_prepare() {
+ default
+ cd "${WORKDIR}"/paperwork-${PV} || die
+ eapply "${FILESDIR}"/${P}-cairo_workaround.patch
+}
+
+python_compile() {
+ emake l10n_compile
+
+ distutils-r1_python_compile
+}