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

_name=eth-utils
pkgname=python-${_name}
pkgver=6.0.0
pkgrel=1
pkgdesc="Utility functions for working with ethereum related codebases."
arch=(any)
url="https://github.com/ethereum/${_name}"
license=(MIT)
depends=(python python-eth-hash python-eth-typing python-cytoolz python-pydantic)
makedepends=(python-build python-installer python-setuptools python-wheel python-sphinx python-sphinx_rtd_theme)
checkdepends=(python-pytest mypy python-hypothesis)
source=(${_name}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz)
sha512sums=('a2c0810427e28de0e752ba97d3340e393ab43418e8643709fc4c000bbc8a1e8ef36ef8af3dffc0fd957adfef3e0fada21ecf5cc27455005a6cb444ba3b019e36')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
  make -C docs man
}

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 -Dm644 docs/_build/man/eth_utils.1 -t "$pkgdir/usr/share/man/man1"
  install -Dm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
}
