# Contributor: Stuart Cardall <developer@it-offshore.co.uk>
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
pkgname=py3-magic
_pkgname=python-magic
pkgver=0.4.27
pkgrel=3
pkgdesc="Python3 wrapper for libmagic"
url="https://pypi.org/project/python-magic/"
arch="noarch"
license="MIT"
depends="python3 libmagic"
makedepends="py3-setuptools"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/ahupp/$_pkgname/archive/$pkgver.tar.gz
	file-5.44.patch
	fix-tests.patch
	"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="py-magic" # Backwards compatibility
provides="py-magic=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	python3 setup.py build
}

check() {
	LC_ALL=en_US.UTF-8 PYTHONPATH=build/lib pytest
}

package() {
	python3 setup.py install --skip-build --root="$pkgdir"
}

sha512sums="
a476730a5caa9a2a784187f57743d5cec4b1829a6a76d4d1fb4e0112caf5487888961df293bc38074ef1a5d313b0fc4aed4cc99b980f5336e8a907c44a33e84e  py3-magic-0.4.27.tar.gz
6cd6a9642e3b2329dce934c3879d58e4e5aa6557e2bda5cc99c985803a64ec4e81886f98738e321cd468e48aa4f2b9e9f848e47bbcd176309db526014bf11788  file-5.44.patch
ce7cd8d719c01124a97802e298a9396ece92c4545e336b39bf67bbf821b7bac2adb097294cf705052676992085b0682a2367bf368f0bb70d33b24b5123c9bfb1  fix-tests.patch
"
