# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Felix Yan <felixonmars@archlinux.org>
# Contributor: Tobias Roettger <toroettg@gmail.com>

pkgname=python-platformdirs
pkgver=4.5.0
pkgrel=1
pkgdesc='A library to determine platform-specific system directories'
arch=('any')
url='https://github.com/tox-dev/platformdirs'
license=('MIT')
depends=('python')
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-hatchling'
  'python-hatch-vcs'
)
checkdepends=(
  'python-pytest'
  'python-pytest-mock'
  'python-appdirs'
)
source=("$pkgname::git+$url#tag=$pkgver")
sha512sums=('91232917f6b9e84d7eabb9b378802a1a717711dfdebddc7b0bbd1d6b10ac89c84a32552f3bda6cb5b1c1043af4f40f4192e9d397cac24c9d359abead424cc942')
b2sums=('f8d4326506e5dd7f987fe6a190295e60d10a9a014a9d0b10eaff5f5c4f6cf820e700c07867921e9eab249b47e535b71fe0508b6773819c0c1c8c4e59f5a99416')

build() {
  cd "$pkgname"

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

check() {
  cd "$pkgname"

  PYTHONPATH="$(pwd)/src" pytest -v
}

package() {
  cd "$pkgname"

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

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