# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Simon Sapin <simon dot sapin at exyr dot org>
# Contributor: Kyle Keen <keenerd@gmail.com>

pkgname=python-mongoengine
pkgver=0.28.2
pkgrel=1
pkgdesc="A Python Object-Document-Mapper for working with MongoDB"
url="https://github.com/MongoEngine/mongoengine"
license=('MIT')
arch=(any)
depends=('python-pymongo')
optdepends=('python-dateutil: for DateTimeField'
            'python-pillow: for ImageField / ImageGridFsProxy')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
checkdepends=('python-pytest-cov' 'python-coverage' 'python-blinker' 'python-pillow' 'python-zipp'
              'python-mongomock')
source=("https://github.com/MongoEngine/mongoengine/archive/v$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('e466874fb624ff06bb5ac3bc02d9f7944e8c65e7f1a5e5645b084c1ebd37b97c9660697e23a26014aa411a58319737838cf05cb903721c6105003891e428e9b3')

build() {
  cd mongoengine-$pkgver
  python -m build -nw
}

check() {
  cd mongoengine-$pkgver
  # No sane way to run it without mongodb
  # python -m pytest
}

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