# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-service-identity
pkgver=24.2.0
pkgrel=2
pkgdesc="Service identity verification for pyOpenSSL"
arch=(any)
license=('MIT')
url="https://pypi.python.org/pypi/service_identity"
depends=('python-attrs' 'python-pyasn1-modules' 'python-pyasn1' 'python-cryptography')
makedepends=('git' 'python-build' 'python-installer' 'python-hatchling' 'python-hatch-fancy-pypi-readme'
             'python-hatch-vcs')
checkdepends=('python-pytest' 'python-idna')
optdepends=('python-idna: for Internationalized Domain Names support')
replaces=('python-service_identity')
source=("git+https://github.com/pyca/service-identity.git#tag=$pkgver")
sha512sums=('66deacd345ac0ace2434320a6679cc17847f38d0905e9f4217ff199a83152291b9e643a9dc64417e3f9278084a6662ce25d489f74c6ad1724eddecac873f17fe')

build() {
  cd service-identity
  python -m build -nw
}

check() {
  cd service-identity
  python -m installer --destdir=tmp_install dist/*.whl
  local python_version=$(python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
  PYTHONPATH="$PWD/tmp_install/usr/lib/python${python_version}/site-packages" pytest
}
 
package() {
  cd service-identity
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
