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

_name=hexbytes
pkgname=python-${_name}
pkgver=1.3.1
pkgrel=2
pkgdesc="Python bytes subclass that decodes hex, with a readable console output"
arch=(any)
url="https://github.com/ethereum/${_name}"
license=(MIT)
depends=(python)
makedepends=(python-build python-installer python-setuptools python-wheel python-sphinx python-sphinx_rtd_theme)
checkdepends=(python-pytest python-eth-utils python-hypothesis)
source=(${_name}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz)
sha512sums=('621c3aaa5d9782f2d78b7d80ed78e7f0d94b7b8222beda498cc5eb18f15a9048fb9718c536aa834efe251dbf5ed80097ce09c00cdfa235fd3ee7505efd39e570')

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