app-text/OCRmyPDF: add 16.10.2, drop old

Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo@sysrq.in>
This commit is contained in:
Anna (cybertailor) Vyalkova
2025-07-05 23:34:17 +05:00
parent 65f6d19e2f
commit 7ed92255d7
5 changed files with 138 additions and 86 deletions

View File

@@ -1,2 +1 @@
DIST ocrmypdf-16.10.0.tar.gz 6809110 BLAKE2B 65167d586d932a75fd0d13a1497423433005f853e2ace36daa0efd3f33a14b31a4e2d3433b63ec350bd6ad5283a09f36409470ae2eab63f9dc5da821c9f69ba1 SHA512 83aef50ca42d5c9c1ce5b88972012d7baed6b001434bf66918c4440ee49cbd9bd2bc0f0766e8a636359e2ab4d71ecd3f55605a57ee37ec66135704b86933b9a6
DIST ocrmypdf-16.9.0.tar.gz 6804849 BLAKE2B 4ab94d90e6b2936a4d39e2f511cca04646506f09c216477a9143a18f68ec66179e22d77d71f4ae06ab553e882860d96ef05daf71932c01a8f3c051ade8e08a90 SHA512 3eaab40f931e231795397a2a9017425489ad6277d4bfc79bc13e9e4a06f7dc4cf0013566ac2ba5e29b6931c8c22cedf679227abb04daa99f22bdbead2f6cb535
DIST ocrmypdf-16.10.2.tar.gz 6996190 BLAKE2B 129897cf83748c6f8d2e5947e547a622eee3a5279772a03402b9d99918be085dc05f5fd647ad2822e6d0cbf3cfa9467ea3660b15dc86f007da7d5e4a12518341 SHA512 28c5c72df765eecd8d7d82a8b92459c8229ac88ce70590c0ee1ca2862a87e518f00805b23befe41ed71c5f99311ac81e5b7638e71553d52bf80f46ab0529578b

View File

@@ -33,7 +33,6 @@ BDEPEND="
test? (
app-text/tessdata_fast[l10n_de,l10n_en]
>=app-text/unpaper-6.1
>=dev-python/hypothesis-6.36.0[${PYTHON_USEDEP}]
>=dev-python/python-xmp-toolkit-2.0.1[${PYTHON_USEDEP}]
>=dev-python/reportlab-3.6.8[${PYTHON_USEDEP}]
>=media-gfx/pngquant-2.5
@@ -41,6 +40,12 @@ BDEPEND="
)
"
PATCHES=(
"${FILESDIR}"/${PN}-16.10.2-suppress-runtime-error.patch
"${FILESDIR}"/${PN}-16.10.2-xfail-tests.patch
)
EPYTEST_PLUGINS=( hypothesis )
EPYTEST_XDIST="yes"
EPYTEST_IGNORE=(
# Useless test

View File

@@ -1,83 +0,0 @@
# Copyright 2020-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=hatchling
PYTHON_COMPAT=( python3_{11..12} )
inherit distutils-r1 optfeature pypi shell-completion
DESCRIPTION="OCRmyPDF adds an OCR text layer to scanned PDF files"
HOMEPAGE="https://github.com/ocrmypdf/OCRmyPDF"
LICENSE="CC-BY-SA-2.5 CC-BY-SA-4.0 MIT MPL-2.0 ZLIB"
SLOT="0"
KEYWORDS="~amd64"
RDEPEND="
>=app-text/ghostscript-gpl-10.01.2
>=app-text/pdfminer-20220319[${PYTHON_USEDEP}]
>=app-text/tesseract-4.1.1[jpeg,tiff,png,webp]
>=dev-python/deprecation-2.1.0[${PYTHON_USEDEP}]
>=dev-python/packaging-20[${PYTHON_USEDEP}]
>=dev-python/pikepdf-8.10.1[${PYTHON_USEDEP}]
>=dev-python/pillow-10.0.1[jpeg2k,lcms,${PYTHON_USEDEP}]
>=dev-python/pluggy-1.0[${PYTHON_USEDEP}]
>=dev-python/rich-13.0[${PYTHON_USEDEP}]
>=media-gfx/img2pdf-0.5[${PYTHON_USEDEP}]
"
# TODO: package PyMuPDF for tests
BDEPEND="
dev-python/hatch-vcs[${PYTHON_USEDEP}]
test? (
app-text/tessdata_fast[l10n_de,l10n_en]
>=app-text/unpaper-6.1
>=dev-python/hypothesis-6.36.0[${PYTHON_USEDEP}]
>=dev-python/python-xmp-toolkit-2.0.1[${PYTHON_USEDEP}]
>=dev-python/reportlab-3.6.8[${PYTHON_USEDEP}]
>=media-gfx/pngquant-2.5
>=media-libs/jbig2enc-0.29
)
"
EPYTEST_XDIST="yes"
EPYTEST_IGNORE=(
# Useless test
tests/test_completion.py
)
EPYTEST_DESELECT=(
# Fails if Tesseract was compiled with Clang
tests/test_rotation.py::test_rotate_deskew_ocr_timeout
# XFAIL reason should be a string, not a tuple
tests/test_metadata.py::test_malformed_docinfo
)
distutils_enable_tests pytest
distutils_enable_sphinx docs \
dev-python/sphinx-issues \
dev-python/sphinx-rtd-theme
export SETUPTOOLS_SCM_PRETEND_VERSION=${PV}
python_test() {
epytest -o addopts=
}
src_install() {
distutils-r1_src_install
newbashcomp misc/completion/ocrmypdf.bash ocrmypdf
dofishcomp misc/completion/ocrmypdf.fish
}
pkg_postinst() {
optfeature "image cleaning support" app-text/unpaper
optfeature "JBIG2 optimization support" media-libs/jbig2enc
optfeature "PNG optimization support" media-gfx/pngquant
# TODO: package pi-heif
#optfeature "HEIF image format support" dev-python/pi-heif
}

View File

@@ -0,0 +1,50 @@
From 332369f1b0b794577ac0bfcd4928bcc7a169689d Mon Sep 17 00:00:00 2001
From: "James R. Barlow" <james@purplerock.ca>
Date: Fri, 13 Jun 2025 01:22:01 -0700
Subject: [PATCH 1/2] Adjust set_start_method decision, changing fork to
forkserver for platforms other than win32, darwin
---
src/ocrmypdf/__main__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/ocrmypdf/__main__.py b/src/ocrmypdf/__main__.py
index cec02d13..29171fe1 100755
--- a/src/ocrmypdf/__main__.py
+++ b/src/ocrmypdf/__main__.py
@@ -78,6 +78,6 @@ def run(args=None):
if __name__ == '__main__':
multiprocessing.freeze_support()
- if os.name == 'posix':
+ if sys.platform not in ('win32', 'darwin'):
multiprocessing.set_start_method('forkserver')
sys.exit(run())
--
2.50.0
From 61163c2aa9f7aa584d3148634a9ca277103eccbf Mon Sep 17 00:00:00 2001
From: "James R. Barlow" <james@purplerock.ca>
Date: Fri, 13 Jun 2025 01:46:30 -0700
Subject: [PATCH 2/2] Fix stupid Python runtimeerror
---
src/ocrmypdf/__main__.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/ocrmypdf/__main__.py b/src/ocrmypdf/__main__.py
index 29171fe1..74a035ef 100755
--- a/src/ocrmypdf/__main__.py
+++ b/src/ocrmypdf/__main__.py
@@ -79,5 +79,6 @@ def run(args=None):
if __name__ == '__main__':
multiprocessing.freeze_support()
if sys.platform not in ('win32', 'darwin'):
- multiprocessing.set_start_method('forkserver')
+ with suppress(RuntimeError):
+ multiprocessing.set_start_method('forkserver')
sys.exit(run())
--
2.50.0

View File

@@ -0,0 +1,81 @@
From 633d59b94f702eb36d51ea3e6a8285b64e7cf710 Mon Sep 17 00:00:00 2001
From: "James R. Barlow" <james@purplerock.ca>
Date: Thu, 3 Jul 2025 09:21:31 -0700
Subject: [PATCH 1/2] xfail Python logging bug in 3.13.3/4
---
tests/test_ghostscript.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tests/test_ghostscript.py b/tests/test_ghostscript.py
index 1a511c44..1ddd07cb 100644
--- a/tests/test_ghostscript.py
+++ b/tests/test_ghostscript.py
@@ -6,6 +6,7 @@ from __future__ import annotations
import logging
import secrets
import subprocess
+import sys
from decimal import Decimal
from unittest.mock import patch
@@ -163,6 +164,10 @@ class TestDuplicateFilter:
logger.addFilter(DuplicateFilter(logger))
return logger
+ @pytest.mark.xfail(
+ (3, 13, 3) <= sys.version_info <= (3, 13, 5),
+ reason="https://github.com/python/cpython/pull/135858",
+ )
def test_filter_duplicate_messages(self, duplicate_filter_logger, caplog):
log = duplicate_filter_logger
log.error("test error message")
@@ -192,6 +197,10 @@ class TestDuplicateFilter:
assert caplog.records[1].msg == "another error message"
assert caplog.records[2].msg == "yet another error message"
+ @pytest.mark.xfail(
+ (3, 13, 3) <= sys.version_info <= (3, 13, 5),
+ reason="https://github.com/python/cpython/pull/135858",
+ )
def test_filter_alt_messages(self, duplicate_filter_logger, caplog):
log = duplicate_filter_logger
log.error("test error message")
--
2.50.0
From 664dffb9d7843c42acc8a7c5889f722872de0f9a Mon Sep 17 00:00:00 2001
From: "James R. Barlow" <james@purplerock.ca>
Date: Thu, 3 Jul 2025 11:30:05 -0700
Subject: [PATCH 2/2] Fix version test
---
tests/test_ghostscript.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/test_ghostscript.py b/tests/test_ghostscript.py
index 1ddd07cb..417badaf 100644
--- a/tests/test_ghostscript.py
+++ b/tests/test_ghostscript.py
@@ -165,7 +165,7 @@ class TestDuplicateFilter:
return logger
@pytest.mark.xfail(
- (3, 13, 3) <= sys.version_info <= (3, 13, 5),
+ (3, 13, 3) <= sys.version_info[:3] <= (3, 13, 5),
reason="https://github.com/python/cpython/pull/135858",
)
def test_filter_duplicate_messages(self, duplicate_filter_logger, caplog):
@@ -198,7 +198,7 @@ class TestDuplicateFilter:
assert caplog.records[2].msg == "yet another error message"
@pytest.mark.xfail(
- (3, 13, 3) <= sys.version_info <= (3, 13, 5),
+ (3, 13, 3) <= sys.version_info[:3] <= (3, 13, 5),
reason="https://github.com/python/cpython/pull/135858",
)
def test_filter_alt_messages(self, duplicate_filter_logger, caplog):
--
2.50.0