# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Chih-Hsuan Yen <yan12125@archlinux.org>

pkgname=httpbin
pkgver=0.10.2
pkgrel=5
pkgdesc="HTTP Request and Response Service"
arch=('any')
url="https://github.com/psf/httpbin"
license=('MIT' 'custom:ISC')
depends=('python' 'python-flask' 'python-decorator'
         'python-brotlicffi' 'python-werkzeug' 'python-flasgger'
         # Not directly used. TODO: ask upstream if it's really needed
         'python-greenlet')
makedepends=('python-setuptools' 'python-build' 'python-installer' 'python-wheel')
checkdepends=('python-pytest')
source=("$pkgname-$pkgver.tar.gz::https://github.com/psf/httpbin/archive/release-v$pkgver.tar.gz"
        "$pkgname-no-six.patch::https://github.com/psf/httpbin/pull/40.patch")
sha512sums=('f271d4d93c7d19392955233a48b7e31f17b76d3364e88cccc081abd2da3763b7b8997778f24e4b756a8219e653809f34b77431723d403348a781f98197376277'
            '61e128cc367bdf323957b313391619edcaeb229cbc08d7591d8bad1904bacfac6c09d9fa63e6c2c13b1325c3b4934c2bdc29480acdcf5fd44b050fbc5ff34460')

prepare() {
  cd httpbin-release-v$pkgver
  patch -Np1 -i ../$pkgname-no-six.patch
}

build() {
  cd httpbin-release-v$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd httpbin-release-v$pkgver
  pytest tests
}

package() {
  cd httpbin-release-v$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl

  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

# vim:set ts=2 sw=2 et:
