# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: George Rawlinson <grawlinson@archlinux.org>

pkgname=python-puremagic
pkgver=1.27
pkgrel=2
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-wheel'
)
checkdepends=('python-pytest')
source=("$pkgname::git+$url#tag=$pkgver")
sha512sums=('ddfba979da40788f5f15325b529ba9f51c955e3d42a2e8a19f2e4c5b5267996233b37cc6695d644d849cca47512df52344dbf162b8ca7d787c195cda357e97f5')
b2sums=('ab2e72a4913f53056632029fae20b75f02a95021cc1e18786f039e9e9f21a2d86bd76a3992f9bed30da0d1717f4333ae17ea529b82aa17bea0a7b64a5e1dbcb1')

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
}
