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

pkgname=python-platformdirs
_name="${pkgname#python-}"
pkgver=4.3.6
pkgrel=2
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=('99759ceddeefc7817a5307eae543504cbbf2c27fe6d5c314d4ceb8bc578a91afc69c562bbd93b1a72d7c72ef06f6f3e9c932a7247d4b5137aa814d834224e99b')
b2sums=('c4f5c4c547fe56faeb84927f69d5968ef31409d819ad33d6f9781f1acea8514a46c83a5ea8383c472936bbb2ed2d52ec74f022e27fa208f08a29796a29dee8e6')

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
}
