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

pkgname=python-puremagic
pkgver=1.28
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=('e1e2d9c7703ec6a43509701445536cbc77afa7f79481d05cb9af8b1184f3c4a9b991eb6fe569348bafd7604862a4580d569d8497e0b48b84afe2b4f4f800f833')
b2sums=('d170d3a1d28ecd3c4d7b7732990473f41f0c6ba22b5d08e6d3340930007f43d9eb8da533fab4dd9dc57dd2c4311d7a6635bf085fb2edcba6be211b92c910c8d4')

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
}
