# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-eth-hash
pkgver=0.8.0
pkgrel=1
pkgdesc="The Ethereum hashing function, keccak256"
arch=('any')
url="https://github.com/ethereum/eth-hash"
license=('MIT')
depends=('python' 'python-pycryptodome')
makedepends=('git' 'python-build' 'python-installer' 'python-setuptools' 'python-wheel'
             'python-sphinx' 'python-sphinx_rtd_theme')
checkdepends=('python-pytest')
source=("git+https://github.com/ethereum/eth-hash.git#tag=v$pkgver")
sha512sums=('fc829456fd1499cf4365e95b6e02ff89e837d5492abc24fc6ce13a08522ff2a6ebf4c8d82c3f464b0c5e9077efdbb6d579b722e033a8e157acab4e3ff1fdf830')

build() {
  cd eth-hash
  python -m build --wheel --no-isolation
  make -C docs man
}

check() {
  cd eth-hash
  PYTHONPATH="$PWD" pytest tests/backends/pycryptodome
}

package() {
  cd eth-hash
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 docs/_build/man/eth_hash.1 -t "$pkgdir"/usr/share/man/man1/
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
