git: 2e06ecfc9b70 - main - textproc/py-ocrmypdf: Update to 16.3.1

From: Kai Knoblich <kai_at_FreeBSD.org>
Date: Sat, 15 Jun 2024 09:24:48 UTC
The branch main has been updated by kai:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2e06ecfc9b702b69b996924e209f270cb5432a23

commit 2e06ecfc9b702b69b996924e209f270cb5432a23
Author:     Kai Knoblich <kai@FreeBSD.org>
AuthorDate: 2024-06-15 09:21:21 +0000
Commit:     Kai Knoblich <kai@FreeBSD.org>
CommitDate: 2024-06-15 09:23:34 +0000

    textproc/py-ocrmypdf: Update to 16.3.1
    
    * Add a workaround to fallback to graphics/py-pillow-heif if the pi_heif
      module isn't available to enable support for converting HEIF/HEIC
      images.
    
    * Remove no longer needed requirements/workarounds while I'm here, as
      OCRmyPDF requires at least Python 3.10 or newer since version 16.x.
    
    Changelog since 15.4.4:
    
    https://github.com/ocrmypdf/OCRmyPDF/blob/v16.3.1/docs/release_notes.rst
    
    PR:             276310
    Reported by:    wen
    Co-Authored by: wen (initial patch for 16.0.4)
    MFH:            No (2024Q4 has Python 3.9 as default)
---
 textproc/py-ocrmypdf/Makefile                      | 26 +++++++++-------------
 textproc/py-ocrmypdf/distinfo                      |  6 ++---
 textproc/py-ocrmypdf/files/patch-pyproject.toml    | 13 -----------
 .../files/patch-src_ocrmypdf___pipeline.py         | 19 ++++++++++++++++
 4 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/textproc/py-ocrmypdf/Makefile b/textproc/py-ocrmypdf/Makefile
index 8d565357c464..42484c49e6bc 100644
--- a/textproc/py-ocrmypdf/Makefile
+++ b/textproc/py-ocrmypdf/Makefile
@@ -1,5 +1,5 @@
 PORTNAME=	ocrmypdf
-DISTVERSION=	15.4.4
+DISTVERSION=	16.3.1
 CATEGORIES=	textproc python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
@@ -12,23 +12,24 @@ LICENSE=	MPL20
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
 BUILD_DEPENDS=	${PY_SETUPTOOLS} \
-		${PYTHON_PKGNAMEPREFIX}setuptools-scm>=0:devel/py-setuptools-scm@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}setuptools-scm>=7.0.5:devel/py-setuptools-scm@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}wheel>=0:devel/py-wheel@${PY_FLAVOR}
 RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}deprecation>=2.1.0:devel/py-deprecation@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}img2pdf>=0.4.4:graphics/py-img2pdf@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}img2pdf>=0.5:graphics/py-img2pdf@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}packaging>=20:devel/py-packaging@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}pillow>=10.0.1:graphics/py-pillow@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}reportlab>=3.6.8:print/py-reportlab@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pillow-heif>0:graphics/py-pillow-heif@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}rich>=13:textproc/py-rich@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}pdfminer.six>=20220319:textproc/py-pdfminer.six@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}pikepdf>=8.7.1:textproc/py-pikepdf@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}pluggy>=0.13.0:devel/py-pluggy@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pikepdf>=8.10.1:textproc/py-pikepdf@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pluggy>=1:devel/py-pluggy@${PY_FLAVOR} \
 		tesseract:graphics/tesseract
 TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}hypothesis>=6.36.0:devel/py-hypothesis@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}pytest-xdist>=2.5.0:devel/py-pytest-xdist@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}python-xmp-toolkit>=2.0.1:textproc/py-python-xmp-toolkit@${PY_FLAVOR}
+		${PYTHON_PKGNAMEPREFIX}python-xmp-toolkit>=2.0.1:textproc/py-python-xmp-toolkit@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}reportlab>=3.6.8:print/py-reportlab@${PY_FLAVOR} \
 
-USES=		ghostscript:run python:3.9+ shebangfix
+USES=		ghostscript:run python:3.10+ shebangfix
 USE_PYTHON=	autoplist concurrent pep517 pytest
 # Skip some checks as they yield wrong results if run with the root account
 PYTEST_IGNORED_TESTS=	test_chmod \
@@ -36,7 +37,6 @@ PYTEST_IGNORED_TESTS=	test_chmod \
 			test_malformed_docinfo # leads to an internal pytest error
 
 SHEBANG_FILES=	src/ocrmypdf/__main__.py \
-		src/ocrmypdf/hocrtransform.py \
 		src/ocrmypdf/pdfinfo/__init__.py
 
 TEST_ARGS=	-n ${MAKE_JOBS_NUMBER}
@@ -55,16 +55,10 @@ UNPAPER_DESC=	Deskew and clean up pages before OCR processing
 PNGQUANT_RUN_DEPENDS=	pngquant:graphics/pngquant
 UNPAPER_RUN_DEPENDS=	unpaper:graphics/unpaper
 
-.include <bsd.port.pre.mk>
-
-.if ${PYTHON_REL} < 31000
-RUN_DEPENDS+=	${PYTHON_PKGNAMEPREFIX}typing-extensions>=4:devel/py-typing-extensions@${PY_FLAVOR}
-.endif
-
 post-install:
 	# Install shell completion files
 	@${MKDIR} ${STAGEDIR}${PREFIX}/etc/bash_completion.d ${STAGEDIR}${PREFIX}/share/fish/vendor_completions.d/
 	${INSTALL_DATA} ${WRKSRC}/misc/completion/ocrmypdf.bash ${STAGEDIR}${PREFIX}/etc/bash_completion.d/
 	${INSTALL_DATA} ${WRKSRC}/misc/completion/ocrmypdf.fish ${STAGEDIR}${PREFIX}/share/fish/vendor_completions.d/
 
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff --git a/textproc/py-ocrmypdf/distinfo b/textproc/py-ocrmypdf/distinfo
index 32f10c6ebfa3..7d40ae109684 100644
--- a/textproc/py-ocrmypdf/distinfo
+++ b/textproc/py-ocrmypdf/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1703856711
-SHA256 (ocrmypdf-15.4.4.tar.gz) = 4696c81cc5b5d64f31ccfe685d10baeb69b42bb0974acddf292d8cf9d97605c3
-SIZE (ocrmypdf-15.4.4.tar.gz) = 6682828
+TIMESTAMP = 1718275162
+SHA256 (ocrmypdf-16.3.1.tar.gz) = 6f872acada73757588f1d1d94f76474166addedc7d72b07faa9101be074bf590
+SIZE (ocrmypdf-16.3.1.tar.gz) = 6722272
diff --git a/textproc/py-ocrmypdf/files/patch-pyproject.toml b/textproc/py-ocrmypdf/files/patch-pyproject.toml
deleted file mode 100644
index 2bec0c44995f..000000000000
--- a/textproc/py-ocrmypdf/files/patch-pyproject.toml
+++ /dev/null
@@ -1,13 +0,0 @@
-Allow build with older versions of devel/py-setuptools_scm .
-
---- pyproject.toml.orig	2023-10-04 08:20:36 UTC
-+++ pyproject.toml
-@@ -1,7 +1,7 @@
- # SPDX-FileCopyrightText: 2022 James R. Barlow
- # SPDX-License-Identifier: MPL-2.0
- [build-system]
--requires = ["setuptools >= 61", "setuptools_scm[toml] >= 7.0.5", "wheel"]
-+requires = ["setuptools >= 61", "setuptools_scm[toml]", "wheel"]
- build-backend = "setuptools.build_meta"
- 
- [project]
diff --git a/textproc/py-ocrmypdf/files/patch-src_ocrmypdf___pipeline.py b/textproc/py-ocrmypdf/files/patch-src_ocrmypdf___pipeline.py
new file mode 100644
index 000000000000..4e6d39914ddb
--- /dev/null
+++ b/textproc/py-ocrmypdf/files/patch-src_ocrmypdf___pipeline.py
@@ -0,0 +1,19 @@
+Fallback to pillow_heif if pi_heif is not present.
+
+--- src/ocrmypdf/_pipeline.py.orig	2024-06-15 08:09:59 UTC
++++ src/ocrmypdf/_pipeline.py
+@@ -45,8 +45,12 @@ except ImportError:
+     from pi_heif import register_heif_opener
+ except ImportError:
+ 
+-    def register_heif_opener():
+-        pass
++    try:
++        from pillow_heif import register_heif_opener
++    except ImportError:
++
++        def register_heif_opener():
++            pass
+ 
+ 
+ T = TypeVar("T")