# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Maintainer: Carl Smedstad <carsme@archlinux.org>

pkgname=python-yarl
pkgver=1.22.0
pkgrel=1
pkgdesc='Yet another URL library'
arch=('x86_64' 'aarch64')
url='https://github.com/aio-libs/yarl/'
license=('Apache-2.0')
depends=(
  'glibc'
  'python'
  'python-idna'
  'python-multidict'
  'python-propcache'
)
makedepends=(
  'cython'
  'python-setuptools'
  'python-build'
  'python-installer'
  'python-wheel'
  'python-expandvars'
)
checkdepends=(
  'python-hypothesis'
  'python-pytest'
)
source=("$url/archive/v$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('58ed8255314c8fb10b32de850f32426d27e0b2df2431d14327320382a304bc6d313f472603233f8e8a3f31f81d65ba693cf83b1058695de6f9eb53caaa83aa09')
b2sums=('54cc94967be2453000d696421a91e3bc185d4816131475e9775147c8dbe13e7ccfb1596032a131d85a1dcbadc6731e6b5607ebba78eafc98f0adf14b412f39d9')

build() {
  cd ${pkgname#python-}-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd ${pkgname#python-}-$pkgver
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  test-env/bin/python -Pm pytest -v --override-ini="addopts="
}

package() {
  cd ${pkgname#python-}-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
}
