# Maintainer: Carl Smedstad <carsme@archlinux.org>

pkgname=python-zlib-ng
pkgver=1.0.0
pkgrel=1
pkgdesc="A drop-in replacement for Python's zlib and gzip modules using zlib-ng"
arch=(x86_64 aarch64)
url=https://github.com/pycompression/python-zlib-ng
license=(PSF-2.0)
depends=(
  glibc
  python
  zlib-ng
)
makedepends=(
  git
  python-build
  python-installer
  python-setuptools
  python-setuptools-scm
  python-wheel
)
checkdepends=(
  python-pytest
  python-pytest-timeout
  python-tests
)
source=("git+$url.git#tag=v$pkgver")
sha256sums=('1e91964d6a0fe6e84013a67c9243870730951ea84f8624f81583e34393832581')

build() {
  cd $pkgname
  export SETUPTOOLS_SCM_PRETEND_VERSION="$pkgver"
  export PYTHON_ZLIB_NG_LINK_DYNAMIC=1
  python -m build --wheel --no-isolation
}

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

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