# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=py3-optimize-images
pkgver=1.5.1
pkgrel=1
pkgdesc="A CLI utility to help you reduce the file size of images"
url="https://no-title.victordomingos.com/projects/optimize-images"
arch="noarch"
license="MIT"
depends="py3-piexif py3-pillow py3-watchdog"
makedepends="py3-gpep517 py3-setuptools py3-wheel"

subpackages="$pkgname-pyc"
source="py3-optimize-images-$pkgver.tar.gz::https://github.com/victordomingos/optimize-images/archive/refs/tags/v.$pkgver.tar.gz"
builddir="$srcdir/optimize-images-v.$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	cd ./tests/
	sh ./extract-all-test-files.sh
	../.testenv/bin/python3 -m optimize_images test-images "$@"
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
df5f4d44c6d97ef1ad679ba323d795b2287bdad69bb6f78a138c2465812534928f8b243247cac5eae63b9f3ea0fd9a209620f0256423d21308d5b6936363502c  py3-optimize-images-1.5.1.tar.gz
"
