# Maintainer: Bruno Pagani <archange@archlinux.org>

_pkg=zict
pkgname=python-${_pkg}
pkgver=3.0.0
pkgrel=5
pkgdesc="Useful Mutable Mappings"
arch=(any)
url="https://github.com/dask/zict/"
license=(BSD)
makedepends=(python-setuptools)
depends=(python python-heapdict)
checkdepends=(python-pytest-timeout python-pytest-repeat python-pytest-asyncio python-lmdb python-psutil)
source=(https://files.pythonhosted.org/packages/source/${_pkg::1}/${_pkg}/${_pkg}-${pkgver}.tar.gz
        https://github.com/dask/zict/commit/b142286c.patch)
#source=(${url}/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha256sums=('e321e263b6a97aafc0790c3cfb3c04656b7066e6738c37fffcca95d803c9fba5'
            '5dcc494602737d1f3d67e0604f6f2a67120d385a0bb0946cd82f41afdf4db13a')

prepare() {
  cd $_pkg-$pkgver
  patch -p1 -i ../b142286c.patch # Fix test hangs
}

build() {
  cd ${_pkg}-${pkgver}
  python setup.py build
}

check() {
  cd ${_pkg}-${pkgver}
  pytest -vv --color=yes zict
}

package() {
  cd ${_pkg}-${pkgver}
  python setup.py install --prefix=/usr --root="${pkgdir}" --optimize=1 --skip-build
  install -Dm644 LICENSE.txt -t "${pkgdir}"/usr/share/licenses/${pkgname}/
}
