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

_name=eth-keys
pkgname=python-${_name}
pkgver=0.7.0
pkgrel=2
pkgdesc="Utility functions for working with ethereum related codebases."
arch=(any)
url="https://github.com/ethereum/${_name}"
license=(MIT)
depends=(python python-eth-utils python-eth-typing python-factory-boy)
makedepends=(python-build python-installer python-setuptools python-wheel)
checkdepends=(python-pytest python-asn1tools python-hypothesis python-pyasn1 python-coincurve)
optdepends=('python-coincurve: for CoinCurveECCBackend support')
source=(${_name}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz)
sha512sums=('3dc48258c7b858347feba413aafd44e73a3a7c4e52b9093982363cd782fb2173dd9afe9b7ea63459d13835c5e57254f735f3624b87d6907c1e621eba5e372aa9')

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"
}
