# 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.2.2
pkgrel=1
pkgdesc='A library to determine platform-specific system directories'
arch=(any)
url='https://github.com/platformdirs/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=('522b24897f31d43353429a101e29723b3ab22f0b7d801fc77ea125868cf1edfa695122350a432ce442c372361892a4f9d57dd6f31562fc14ebca30c4d4d03e4b')
b2sums=('55a18ec0b5d679c3c7b6cdb2856048b9af051e8ac4a1d839806321dff165d09a1a610fa8d3e3bb152ae69f39e5a0480723c4eaf6f269056c1bd88ac198e0af94')

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
}
