# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-dogpile.cache
pkgver=1.3.3
pkgrel=3
pkgdesc="A caching front-end based on the Dogpile lock"
arch=('any')
url="https://pypi.python.org/pypi/dogpile.cache"
license=('BSD')
depends=('python-decorator' 'python-stevedore')
makedepends=('python-setuptools' 'python-build' 'python-installer' 'python-wheel')
checkdepends=('memcached' 'pifpaf' 'valkey' 'python-mako' 'python-redis' 'python-pytest'
              'python-pylibmc')
source=("https://pypi.io/packages/source/d/dogpile.cache/dogpile.cache-$pkgver.tar.gz")
sha512sums=('80809d072167c62dcc731ab5b265c54bcc6f6a1dc09e3ea88959a34823dc0bb776b61166b8e60812dd47c38e8f23ba55c2be173d600a10c4c400c1334d0339fb')

build() {
  cd dogpile.cache-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd dogpile.cache-$pkgver
  python -m pytest -k 'not test_memcached_backend and not test_redis_backend'
  pifpaf --env-prefix DOGPILE run memcached --port 11234 -- python -m pytest tests/cache/test_memcached_backend.py
  pifpaf --env-prefix DOGPILE run redis --port 11234 -- python -m pytest tests/cache/test_redis_backend.py
}

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

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