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

pkgname=python-cryptodatahub
pkgver=1.6.0
pkgrel=1
pkgdesc='Repository of cryptography-related data'
arch=('any')
url='https://gitlab.com/coroner/cryptodatahub'
license=('MPL-2.0')
depends=('python'
         'python-asn1crypto'
         'python-attrs'
         'python-dateutil'
         'python-urllib3')
optdepends=('python-beautifulsoup4: update-ct-log, update-oqs and update-trust-stores'
            'python-yaml: update-oqs')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-setuptools-scm'
             'python-wheel')
checkdepends=('python-beautifulsoup4' 'python-pyfakefs' 'python-yaml')

_builddir="cryptodatahub-v${pkgver}"

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

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

check() {
  cd "${_builddir}"
  CRYPTODATAHUB_TEST_SKIP_LIVE_SERVER=1 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"
}
