# Maintainer: Xeonacid <h.dwwwwww@gmail.com>

_name=lru-dict
pkgname=python-${_name}
pkgver=1.5.0
pkgrel=2
pkgdesc="A fast and memory efficient LRU cache for Python"
arch=(x86_64)
url="https://github.com/amitdev/${_name}"
license=(MIT)
depends=(glibc python)
makedepends=(python-build python-installer python-setuptools python-wheel)
checkdepends=(python-pytest)
source=(${_name}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz)
sha512sums=('ee316c829f63e7e8772167f21aa71e981318d35b5911cc313e39dabca7e375406a0ecca6552477a729cfcf863cf954a1549cf26a8c1a881d4666f30ed00cdc83')

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

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

package() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
  install -Dm644 README.rst -t "$pkgdir/usr/share/doc/$pkgname"
}
