# Maintainer: Szilárd Pfeiffer <coroner@pfeifferszilard.hu>

pkgname=python-cryptoparser
pkgver=1.6.0
pkgrel=1
pkgdesc='An analysis oriented security protocol parser and generator'
arch=('any')
url='https://gitlab.com/coroner/cryptoparser'
license=('MPL-2.0')
depends=('python'
         'python-asn1crypto'
         'python-attrs'
         'python-cryptodatahub>=1.6.0'
         'python-urllib3')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-setuptools-scm'
             'python-wheel')
checkdepends=('python-pyfakefs')

_builddir="cryptoparser-v${pkgver}"

source=("${pkgname}-${pkgver}.tar.gz::${url}/-/archive/v${pkgver}/${_builddir}.tar.gz")
sha256sums=('1a3d4320268e4b12621ca93d37c119a7da5fbe2916b2575695778f28085952ef')

build() {
  cd "${_builddir}"
  python -m build --wheel --no-isolation
}

check() {
  cd "${_builddir}"
  python -m unittest discover
}

package() {
  cd "${_builddir}"
  python -m installer --destdir="${pkgdir}" dist/*.whl
  install -Dm644 LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.txt"
}
