# Maintainer: Fredrick Brennan <copypaste@kittens.ph>
# Maintainer: Pig Monkey <pm@pig-monkey.com>
# Contributor: mutantmonkey <aur@mutantmonkey.in>
# Contributor: Stephan Eisvogel <eisvogel at embinet dot de>
# Contributor: Daniel Reuter <daniel.robin.reuter@googlemail.com>
# Contributor: Integral <integral@member.fsf.org>

pkgname=ocrmypdf
pkgver=17.10.0
pkgrel=1
pkgdesc="A tool to add an OCR text layer to scanned PDF files, allowing them to be searched"
url="https://github.com/${pkgname}/OCRmyPDF"
arch=('any')
license=('MPL-2.0')
depends=(
	'python>=3.9'
	'img2pdf'
	'python-pillow'
	'tesseract'
	'ghostscript'
	'python-pikepdf'
	'python-reportlab'
	'python-pdfminer'
	'python-pluggy'
	'python-rich'
	'python-packaging'
	'python-deprecation'
	'python-fpdf2'
	'python-pydantic'
	'python-uharfbuzz'
)
makedepends=('python-setuptools-scm>=7.0.5' 'python-build' 'python-installer' 'python-wheel' 'python-hatchling' 'python-hatch-vcs')
optdepends=(
	'jbig2enc: Better compression algorithm; results in smaller PDF files'
	'pngquant: support for higher optimization levels'
	'unpaper: support for cleaning up pagaes before OCR'
)
source=("${url}/releases/download/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha256sums=('3e80a22e7ca9a746034e990414c9f18791f168800f3ede92101504f45be6129c')
install="${pkgname}.install"

build() {
	cd "${pkgname}-${pkgver}/"
	python -m build --wheel --no-isolation
}

package() {
	cd "${pkgname}-${pkgver}/"
	python -m installer --destdir="${pkgdir}" dist/*.whl
}
