add ocrmypdf ebuild

This commit is contained in:
2025-11-18 19:14:16 +01:00
parent 5061b80f04
commit 7e9817ee87
2 changed files with 91 additions and 0 deletions

View File

@ -0,0 +1,2 @@
DIST ocrmypdf-16.12.0.tar.gz 7037326 BLAKE2B b3f592219c70a940567159ff9b77895d3c31139fe4fc8a74ec7b07e815883b9e69c158292d7aafc5f98d677ab63b273904ecc34d5627460b3977f472c8bd5f9f SHA512 fba641ca8b2e6757c8f1d8f30a61b02f9ba4e803483f0607e0af5814a48a9535e80fff4d66bfe51aec24a3e69c1350d8990cdbe0d373a6cb52fa16881fe7ac98
EBUILD OCRmyPDF-16.12.0.ebuild 2333 BLAKE2B ec51dfbff308f194d28cb480e059709895565d92d53c4ea366d376f8c54075f624873a5d918da01617f29eb5df5c587fca21d685ec47fd8f920eb3f865081a86 SHA512 641fe7b804bb141b7e1bf1744b3bb98eb3aba24427abd9be999fd75154dae0ef8096b569d2c49392c28da046e16b15412b5ea704ab7ba830d9b9ac60b4fb5ecf

View File

@ -0,0 +1,89 @@
# 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..13} )
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/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
)
"
#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
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
}
RESTRICT="mirror test"