# Maintainer: Hu Butui <hot123tea123@gmail.com>
# Contributor: Kyle Manna <kyle[at]kylemanna[d0t]com>

_pkgname=affine
pkgname=python-affine
pkgver=3.0rc3
pkgrel=1
pkgdesc="Python package for matrices describing affine transformation of the plane"
arch=('any')
url='https://github.com/rasterio/affine'
license=('BSD-3-Clause')
makedepends=(
  python-build
  python-installer
  python-wheel
  python-flit-core
)
depends=(
  python
)
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/rasterio/affine/archive/refs/tags/${pkgver}.tar.gz")
sha512sums=('272f1656ac4d5ffea023a7fe4559c439c5dfa7e23da0e6eed24fee211465473531af353ba31dff9b188f532a6db3c96d1e60ed83457b2bc4174f32e724b29c84')

build() {
  cd "${_pkgname}-${pkgver}"
  python -m build --wheel --no-isolation
}

package() {
  cd "${_pkgname}-${pkgver}"
  python -m installer --destdir="${pkgdir}" dist/*.whl
  install -Dm644 -t "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE.txt
  # delete tests dir
  local site_packages=$(python -c 'import site; print(site.getsitepackages()[0])')
  rm -rfv "${pkgdir}${site_packages}/affine/tests"
}
# vim:set ts=2 sw=2 et:
