# Contributor: Dhruvin Gandhi <contact@dhru.vin>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-binaryornot
_commit=360d7aeefeccf6b5359ac4dab8d7b6411d33ec08
pkgver=0.4.4
pkgrel=5
pkgdesc="Python package to check if a file is binary or text"
url="https://github.com/audreyr/binaryornot"
arch="noarch"
license="BSD-3-Clause"
depends="py3-chardet"
makedepends="py3-setuptools py3-gpep517 py3-installer py3-wheel"
checkdepends="py3-pytest py3-hypothesis"
subpackages="$pkgname-pyc"
source="https://github.com/audreyfeldroy/binaryornot/archive/$_commit.tar.gz"
builddir="$srcdir/binaryornot-$_commit"

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
	# encodings directory contains non-utf8 test data, and no tests
	.testenv/bin/python3 -m pytest --ignore-glob="tests/isBinaryFile/encodings"
}

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

sha512sums="
6496b24882926c9d149d1fa61b7d45ddb7ba713c6b4c512e85f3a993c05ac6ba41106a4b62fbd9bb6250072b2a772dde5baf139add2c132ce86af548c7b095e6  360d7aeefeccf6b5359ac4dab8d7b6411d33ec08.tar.gz
"
