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

_name=asn1tools
pkgname=python-${_name}
pkgver=0.167.0
pkgrel=4
pkgdesc="ASN.1 parsing, encoding and decoding."
arch=(any)
url="https://github.com/eerimoq/${_name}"
license=(MIT)
depends=(python python-pyparsing python-bitstruct python-prompt_toolkit python-diskcache)
makedepends=(python-build python-installer python-setuptools python-wheel)
checkdepends=(python-pytest)
source=(${_name}-${pkgver}.tar.gz::${url}/archive/${pkgver}.tar.gz)
sha512sums=('5e7942829d3b1b2bf0a25bafc01eb73dae5b2034b7f76d854280e08d9db38856fe47b635cc027825983dd9510e829410c822c85c126e055cd46c380880387eb3')

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 tests/ -k "not (test_c_source or test_command_line_generate or test_parse_parameterization or test_missing_parameterized_value)"
}

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.rst -t "$pkgdir/usr/share/doc/$pkgname"
}
