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

pkgname=httpbin
pkgver=0.10.2
pkgrel=7
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'
         # Not directly used. TODO: ask upstream if it's really needed
         'python-greenlet')
makedepends=('git' 'python-setuptools' 'python-build' 'python-installer' 'python-wheel')
checkdepends=('python-pytest')
source=("git+https://github.com/psf/httpbin.git#tag=v$pkgver")
sha512sums=('3fa97c934ca4d8541c9082451efe78bc88a7058631c1a45acd061f4e1926eced38ae4eb7660f6f396a0ce7d4b372a9f1db2e6458fd7b79bd1435cf874dd1ef5f')

prepare() {
  cd httpbin
  # Remove six
  git cherry-pick -n 17d02f215e18df999facc20808f47fcbb72f3a18
  # Remove flasgger
  git cherry-pick -n 24378a6f92ea538d45eb96ab9d5abcda895e5a19
}

build() {
  cd httpbin
  python -m build --wheel --no-isolation
}

check() {
  cd httpbin
  pytest tests
}

package() {
  cd httpbin
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}

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