# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Maintainer: Caleb Maclennan <caleb@alerque.com>

pkgname=python-puremagic
pkgver=2.0.0b4
pkgrel=1
pkgdesc="A Python module that will identify a file based off it's magic numbers"
arch=('any')
url='https://github.com/cdgriffith/puremagic'
license=('MIT')
depends=('python')
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-setuptools'
  'python-setuptools-scm'
  'python-wheel'
)
checkdepends=('python-pytest')
source=("$pkgname::git+$url#tag=$pkgver")
sha512sums=('3af9c1ade15b1c3e13f6faf0d28bcb36fdd5cdf48ad8aeada9b619c9e1ed08345c1dc79b0fbd3f2342fe5b2315af7304bc137664f584f03831d3c300e9c64ded')
b2sums=('4697cf24b1607e25c26562cadf5b927df61a4716a19ba6101dda00aaa791e0a42b5242cd71c2c96f83bf7d7b63789d2803a244b56ea32049dabc1d4ad8b3b265')

build() {
  cd "$pkgname"

  python -m build --wheel --no-isolation
}

check() {
  cd "$pkgname"

  PYTHONPATH="$PWD:$PYTHONPATH" pytest -v
}

package() {
  cd "$pkgname"

  python -m installer --destdir="$pkgdir" dist/*.whl

  # license
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}
