# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: cclin <cclinet@outlook.com>

pkgname=python-aiofiles
pkgver=24.1.0
pkgrel=1
pkgdesc='File support for asyncio'
arch=(any)
license=(Apache-2.0)
url=https://github.com/Tinche/aiofiles
depends=(python)
makedepends=(
  git
  python-build
  python-hatchling
  python-installer
)
checkdepends=(
  python-pytest-asyncio
  python-pytest
)
_tag=a637d6ba623c10877ac5969a2ea4d900b8c34945
source=(git+https://github.com/Tinche/aiofiles.git#tag=${_tag})
b2sums=('206ba2dd8762d5a7d9f74955172a824e81498439002bca4c088f37948b3ea382ba8e50885737a5247f35552abcf85026651a060212b27b8c62bd53c02b3e0df9')

pkgver() {
  cd aiofiles
  git describe --tags | sed 's/^v//'
}

build() {
  cd aiofiles
  python -m build --wheel --no-isolation
}

check() {
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  cd aiofiles
  python -m installer --destdir=test_dir dist/*.whl
  export PYTHONPATH="test_dir/$site_packages:$PYTHONPATH"
  pytest -vv
}

package() {
  python -m installer --destdir="${pkgdir}" aiofiles/dist/*.whl
  install -Dm 644 aiofiles/LICENSE -t "${pkgdir}"/usr/share/licenses/python-aiofiles/
}

# vim: ts=2 sw=2 et:
