# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Daniel M. Capella <polyzen@archlinux.org>
# Contributor: Jeremy "Ichimonji10" Audet <ichimonji10 at gmail dot com>
# Contributor: pumpkin <pumpkin at mailoo dot org>
# Contributor: Vsevolod Balashov <vsevolod at balashov dot name>

pkgname=gunicorn
pkgver=22.0.0
pkgrel=2
pkgdesc='WSGI HTTP Server for UNIX'
arch=('any')
url='https://gunicorn.org/'
license=('MIT')
depends=('python-packaging')
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-setuptools'
  'python-wheel'
)
checkdepends=(
  'python-aiohttp'
  'python-eventlet'
  'python-gevent'
  'python-pytest'
)
optdepends=(
  'python-eventlet: for asynchronous request handling with eventlet'
  'python-gevent: for asynchronous request handling with gevent'
  'python-setproctitle: for process renaming'
  'python-tornado: for asynchronous request handling with tornado'
)
source=("git+https://github.com/benoitc/$pkgname.git#tag=$pkgver")
b2sums=('ceba81b2dc5914f6f0aba0c8971ed36af1e0db078df3bcbb1381e3928a34152e2c251b145476522764582b556e176c1cbb3762e1a0ea2a2d8219f63f0e4a8180')

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

check() {
  cd $pkgname
  python -m pytest --override-ini="addopts="
}

package() {
  cd $pkgname
  python -m installer --destdir="$pkgdir" dist/*.whl

  # Symlink license file
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  install -d "$pkgdir"/usr/share/licenses/$pkgname
  ln -s "$site_packages"/$pkgname-$pkgver.dist-info/LICENSE \
    "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

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