_name=aioopenssl
pkgname=python-aioopenssl
pkgver=0.6.0
pkgrel=6
pkgdesc="TLS-capable transport using OpenSSL for asyncio"
arch=(any)
url="https://github.com/horazont/aioopenssl"
license=('Apache 2.0')
depends=('python-pyopenssl')
makedepends=('python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_name::1}/${_name}/aioopenssl-0.6.0.tar.gz")
sha256sums=('eae2fb193ec0d2a3f752f72d8f672191cc836b1039de5e334cc9cb835b800831')

build() {
  cd "$srcdir/aioopenssl-0.6.0"
  python3 setup.py build
}

package() {
  cd "$srcdir/aioopenssl-0.6.0"
  python3 setup.py install --root=$pkgdir --optimize=1 --skip-build

  # make sure we don't install any world-writable or root-readable-only files
  # we shouldn't need to fix ownership as we extract tarballs as a non-root user
  # https://github.com/pypa/setuptools/issues/1328
  # https://github.com/LonamiWebs/Telethon/issues/1605
  chmod u=rwX,go=rX -R "$pkgdir"
  # make sure we don't install annoying files
  local _site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  rm -rf "$pkgdir/$_site_packages/tests/"
}

