freebsd-ports/textproc/py-ocrmypdf/Makefile
Charlie Li 5d4139f8bd
devel/py-setuptools-scm: update to 8.0.4
Directory and PORTNAME changed to match normalised name in release
tarball; consumers updated to match.

Although setuptools itself is specified as a run dependency in the
Python package metadata, it is currently left out here to prevent
environment pollution until at least PR 270510 is committed.
Additionally, this version of setuptools-scm requires setuptools>=61,
which means this version is only meant for USE_PYTHON=pep517 ports
as all USE_PYTHON=distutils ports will switch to devel/py-setuptools58
also after PR 270510. science/py-emmet-core is switched to
devel/py-setuptools_scm7 accordingly, as it specifies setuptools-scm<8.
devel/py-{flit-scm,hatch-vcs} have ${PY_SETUPTOOLS} added to
RUN_DEPENDS to compensate.

Further details: https://wiki.freebsd.org/Python/setuptools

Reported by: yuri
Co-authored by: matthew
Exp-run by: antoine (earlier iteration)
Approved by: yuri (science/py-emmet-core, previous iteration)
PR: 272134
Differential Revision: https://reviews.freebsd.org/D39288
2024-02-29 02:18:32 -05:00

71 lines
2.9 KiB
Makefile

PORTNAME= ocrmypdf
DISTVERSION= 15.4.4
CATEGORIES= textproc python
MASTER_SITES= PYPI
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
MAINTAINER= kai@FreeBSD.org
COMMENT= Adds an OCR text layer to scanned PDF files
WWW= https://github.com/ocrmypdf/OCRmyPDF
LICENSE= MPL20
LICENSE_FILE= ${WRKSRC}/LICENSE
BUILD_DEPENDS= ${PY_SETUPTOOLS} \
${PYTHON_PKGNAMEPREFIX}setuptools-scm>=0: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}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}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} \
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}
USES= ghostscript:run python:3.9+ 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 \
test_input_file_not_readable \
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}
TEST_ENV= PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
NO_ARCH= yes
PLIST_FILES= etc/bash_completion.d/ocrmypdf.bash share/fish/vendor_completions.d/ocrmypdf.fish
OPTIONS_DEFINE= PNGQUANT UNPAPER
OPTIONS_DEFAULT=PNGQUANT UNPAPER
PNGQUANT_DESC= Optimizes the encoding of PNG-style images in PDFs
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>