# Maintainer: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
# Contributor: Hugo Osvaldo Barrera <hugo@osvaldobarrera.com.ar>

pkgname=python-ndg-httpsclient
_pkgname=ndg_httpsclient
pkgver=0.5.1
pkgrel=17
pkgdesc="Provides enhanced HTTPS support for httplib and urllib2 using PyOpenSSL"
arch=(any)
url="https://pypi.python.org/pypi/ndg-httpsclient"
license=('BSD-3-Clause')
depends=(python-pyopenssl python-pyasn1)
makedepends=(python-setuptools python-build python-installer python-wheel)
options=(!emptydirs)
source=(https://files.pythonhosted.org/packages/source/n/ndg-httpsclient/$_pkgname-$pkgver.tar.gz)
sha256sums=('d72faed0376ab039736c2ba12e30695e2788c4aa569c9c3e3d72131de2592210')

build() {
  cd "$srcdir"/$_pkgname-$pkgver
  python -m build --wheel --no-isolation
}

package() {
  _site_packages=$(python -sSc 'import site; print(site.getsitepackages()[0])')

  cd "$srcdir"/$_pkgname-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm0644 "$pkgdir$_site_packages"/ndg/httpsclient/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
