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

_name=py_ecc
pkgname=python-${_name}
pkgver=8.0.0
pkgrel=2
pkgdesc="Python implementation of ECC pairing and bn_128 and bls12_381 curve operations"
arch=(any)
url="https://github.com/ethereum/${_name}"
license=(MIT)
depends=(python python-eth-typing python-eth-utils)
makedepends=(python-build python-installer python-setuptools python-wheel)
checkdepends=(python-pytest)
source=(${_name}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz)
sha512sums=('598cdd1cc4db19eefce6ba1edf9e47a883d49e995c43d5d6309b5d8f36c1e13f2b1bdcce876500dc0290c13334ff83ab4f58f8a4823d8a1fd94eed9067e690d0')

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 --showlocals tests/
}

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