# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

_pkgname=yarl
pkgname=python-yarl
pkgver=1.9.4
pkgrel=2
pkgdesc='Yet another URL library'
url='https://github.com/aio-libs/yarl/'
arch=('x86_64' 'aarch64')
license=('Apache-2.0')
depends=('glibc' 'python' 'python-multidict' 'python-idna')
makedepends=('cython' 'python-setuptools' 'python-build' 'python-installer' 'python-wheel' 'python-expandvars')
checkdepends=('python-pytest' 'python-pytest-cov' 'python-pytest-xdist')
source=(https://github.com/aio-libs/yarl/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha512sums=('e31a36539166034f3b231e1f9fc47b7d0d1aea0424b6054e1858eefa9f290350ee8b1c74bb90a120d6b9f3c13fe7b675d6e0676272b3222b788d479ae9fd3ff5')
b2sums=('c0022b32b41c1125d788c656883b3552314b138601fef72cc55ce90fc9986f44912395977ba6ac27d344c0a3593172265fb664eb6a696de9787a2474f61d14ce')

prepare() {
  cd ${_pkgname}-${pkgver}
  sed 's| .install-cython ||g' -i Makefile
}

build() {
  cd ${_pkgname}-${pkgver}
  make cythonize
  export LANG=en_US.UTF-8
  python -m build --wheel --no-isolation
}

check() {
  cd ${_pkgname}-${pkgver}
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  cd tests
  ../test-env/bin/python -m pytest -v
}

package() {
  cd ${_pkgname}-${pkgver}
  #LANG=en_US.UTF-8 python setup.py install --root="${pkgdir}" -O1 --skip-build
  export LANG=en_US.UTF-8
  python -m installer --destdir="$pkgdir" dist/*.whl
}

# vim: ts=2 sw=2 et:
