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)
This commit is contained in:
Kai Knoblich 2024-06-15 11:21:21 +02:00
parent d631386347
commit 2e06ecfc9b
4 changed files with 32 additions and 32 deletions

View file

@ -1,5 +1,5 @@
PORTNAME= ocrmypdf PORTNAME= ocrmypdf
DISTVERSION= 15.4.4 DISTVERSION= 16.3.1
CATEGORIES= textproc python CATEGORIES= textproc python
MASTER_SITES= PYPI MASTER_SITES= PYPI
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
@ -12,23 +12,24 @@ LICENSE= MPL20
LICENSE_FILE= ${WRKSRC}/LICENSE LICENSE_FILE= ${WRKSRC}/LICENSE
BUILD_DEPENDS= ${PY_SETUPTOOLS} \ 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} ${PYTHON_PKGNAMEPREFIX}wheel>=0:devel/py-wheel@${PY_FLAVOR}
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}deprecation>=2.1.0:devel/py-deprecation@${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}packaging>=20:devel/py-packaging@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}pillow>=10.0.1:graphics/py-pillow@${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}rich>=13:textproc/py-rich@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}pdfminer.six>=20220319:textproc/py-pdfminer.six@${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}pikepdf>=8.10.1:textproc/py-pikepdf@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}pluggy>=0.13.0:devel/py-pluggy@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}pluggy>=1:devel/py-pluggy@${PY_FLAVOR} \
tesseract:graphics/tesseract tesseract:graphics/tesseract
TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}hypothesis>=6.36.0:devel/py-hypothesis@${PY_FLAVOR} \ 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}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 USE_PYTHON= autoplist concurrent pep517 pytest
# Skip some checks as they yield wrong results if run with the root account # Skip some checks as they yield wrong results if run with the root account
PYTEST_IGNORED_TESTS= test_chmod \ PYTEST_IGNORED_TESTS= test_chmod \
@ -36,7 +37,6 @@ PYTEST_IGNORED_TESTS= test_chmod \
test_malformed_docinfo # leads to an internal pytest error test_malformed_docinfo # leads to an internal pytest error
SHEBANG_FILES= src/ocrmypdf/__main__.py \ SHEBANG_FILES= src/ocrmypdf/__main__.py \
src/ocrmypdf/hocrtransform.py \
src/ocrmypdf/pdfinfo/__init__.py src/ocrmypdf/pdfinfo/__init__.py
TEST_ARGS= -n ${MAKE_JOBS_NUMBER} 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 PNGQUANT_RUN_DEPENDS= pngquant:graphics/pngquant
UNPAPER_RUN_DEPENDS= unpaper:graphics/unpaper 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: post-install:
# Install shell completion files # Install shell completion files
@${MKDIR} ${STAGEDIR}${PREFIX}/etc/bash_completion.d ${STAGEDIR}${PREFIX}/share/fish/vendor_completions.d/ @${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.bash ${STAGEDIR}${PREFIX}/etc/bash_completion.d/
${INSTALL_DATA} ${WRKSRC}/misc/completion/ocrmypdf.fish ${STAGEDIR}${PREFIX}/share/fish/vendor_completions.d/ ${INSTALL_DATA} ${WRKSRC}/misc/completion/ocrmypdf.fish ${STAGEDIR}${PREFIX}/share/fish/vendor_completions.d/
.include <bsd.port.post.mk> .include <bsd.port.mk>

View file

@ -1,3 +1,3 @@
TIMESTAMP = 1703856711 TIMESTAMP = 1718275162
SHA256 (ocrmypdf-15.4.4.tar.gz) = 4696c81cc5b5d64f31ccfe685d10baeb69b42bb0974acddf292d8cf9d97605c3 SHA256 (ocrmypdf-16.3.1.tar.gz) = 6f872acada73757588f1d1d94f76474166addedc7d72b07faa9101be074bf590
SIZE (ocrmypdf-15.4.4.tar.gz) = 6682828 SIZE (ocrmypdf-16.3.1.tar.gz) = 6722272

View file

@ -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]

View file

@ -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")