# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Andy Weidenbaum <archbaum@gmail.com>

pkgname=python-requests-unixsocket
_pkgname="${pkgname#python-}"
pkgver=0.3.0
pkgrel=4
pkgdesc='Use requests to talk HTTP via a UNIX domain socket'
arch=('any')
url='https://github.com/msabramo/requests-unixsocket'
license=('Apache')
depends=(
  'python'
  'python-requests'
  'python-urllib3'
)
makedepends=(
  'python-build'
  'python-installer'
  'python-wheel'
  'python-setuptools'
  'python-pbr'
)
options=('!emptydirs')
source=("$pkgname-$pkgver.tar.gz::https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('21c887b0c3fa526a2debb3960e0ea4dc3b3015cdd517459b6484501176321408d1b4c87dd2840c7d8b71d08fa9114f655ae03f8bc9ff1fca33c914900ef82f5b')
b2sums=('5b46ea051729326498f50ba7a952429d271deb102060f8e3019d259ddc21dbffdca8960e140c7ccb25898034cf37fb90dd143c970e75bdc6e6442e9515f14d6e')

build() {
  cd "$_pkgname-$pkgver"

  python -m build --wheel --no-isolation
}

package() {
  cd "$_pkgname-$pkgver"

  python -m installer --destdir="$pkgdir" dist/*.whl

  # remove tests folder from package
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  rm -rf "$pkgdir$site_packages/${_pkgname/-/_}/"{tests,testutils.py}
}
