# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=py-idna-ssl
_pkgname=${pkgname/py-/}
pkgver=1.0.0
pkgrel=0
pkgdesc="Patch ssl.match_hostname for Unicode(idna) domains support"
url=" https://github.com/aio-libs/idna_ssl"
arch="all"
license="MIT"
depends="py-idna"
makedepends="python2-dev python3-dev py-setuptools"
subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3"
source="$pkgname-$pkgver.tar.gz::https://github.com/aio-libs/$_pkgname/archive/v$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
        cd "$builddir"
        python2 setup.py build
        python3 setup.py build
}

check() {
        cd "$builddir"
        python2 setup.py check
        python3 setup.py check
}

package() {
        mkdir -p "$pkgdir"
}

_py2() {
        replaces="$pkgname"
        _py python2
}

_py3() {
        _py python3
}

_py() {
        local python="$1"
        pkgdesc="$pkgdesc (for $python)"
        depends="$python"
        install_if="$pkgname=$pkgver-r$pkgrel $python"

        cd "$builddir"
        $python setup.py install --prefix=/usr --root="$subpkgdir"
}


sha512sums="50ddc71777d596f677ac2f29d8df9553a64e9e71c0e50ae240876c90e0dcb3aa1f0a806d493c188dfe6871c1baeefe4b4cf8a654a0918cb57e1727a1a9ddbf32  py-idna-ssl-1.0.0.tar.gz"
