# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-puremagic
pkgver=1.28
pkgrel=0
pkgdesc="Pure python implementation of identifying files based off their magic numbers"
url="https://github.com/cdgriffith/puremagic"
arch="noarch"
license="MIT"
makedepends="py3-setuptools py3-gpep517 py3-wheel"
checkdepends="py3-pytest py3-pytest-cov"
subpackages="$pkgname-pyc"
source="https://github.com/cdgriffith/puremagic/archive/refs/tags/$pkgver/puremagic-$pkgver.tar.gz"
builddir="$srcdir/puremagic-$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
	gpep517 install-wheel --destdir .testenv --prefix '' .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl
}

sha512sums="
8a9d04b34d32a552fa51de1c720556d46c2aef99913d9c339838a682e8758ba16c66bcd4d205fe59dd6ae7cd27c311b24638a4084baf7a27869e5304e4994d27  puremagic-1.28.tar.gz
"
