# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Contributor: Alexander Rødseth <rodseth@gmail.com>
# Contributor: Thomas Dziedzic < gostrc at gmail >
# Contributor: Dan Serban
# Contributor: Richard Murri

pkgname=python-werkzeug
pkgver=3.0.1
pkgrel=1
pkgdesc='Swiss Army knife of Python web development'
url='https://werkzeug.palletsprojects.com/'
arch=('any')
license=('custom:BSD')
depends=('python-markupsafe')
makedepends=('python-build' 'python-installer' 'python-flit-core')
checkdepends=('python-pytest' 'python-pytest-timeout' 'python-pytest-xprocess' 'python-requests'
              'python-ephemeral-port-reserve' 'python-greenlet' 'python-watchdog'
              'python-cryptography')
source=("https://github.com/pallets/werkzeug/archive/${pkgver}/$pkgname-$pkgver.tar.gz"
         https://github.com/pallets/werkzeug/commit/4e5bdca7.patch)
sha512sums=('125a5c7680cba726149198802efa90d06c6586daeafcd0960feda637b765356f602df83af7b14996994303c52d32bc6fa044b774f42f0b8991008d1396675033'
            'eddd871dfe1faf3b2ab35dac32fe991ee26679eb6116fe6290e7a20f2abe430a025b0345b39137746c05c0da79f555ca10d73df298eb02d5c5ef82b13d6384ad')

prepare() {
  patch -d werkzeug-$pkgver -p1 < 4e5bdca7.patch # Fix tests with pytest 8
}

build() {
  cd "werkzeug-$pkgver"

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

check() {
  cd "werkzeug-$pkgver"
  PYTHONPATH="src" pytest \
    --deselect=tests/test_serving.py \
    --deselect=tests/test_debug.py::test_basic \
    --deselect=tests/middleware/test_http_proxy.py
}

package() {
  cd "werkzeug-$pkgver"

  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm 644 LICENSE.rst -t "$pkgdir/usr/share/licenses/$pkgname"
}

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