# Maintainer: Jelle van der Waa <jelle@archlinux.org
# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Husam Bilal <husam212 AT gmail DOT com>

_name=sqlalchemy-utils
pkgname=python-sqlalchemy-utils
pkgver=0.41.2
pkgrel=4
epoch=1
pkgdesc='Various utility functions, new data types and helpers for SQLAlchemy'
url='https://github.com/kvesteri/sqlalchemy-utils'
depends=('python' 'python-sqlalchemy' 'python-babel' 'python-arrow'
         'python-intervals' 'python-phonenumbers' 'python-passlib' 'python-colour'
         'python-dateutil' 'python-furl' 'python-cryptography' 'python-pendulum')
checkdepends=('python-pytest' 'python-flexmock' 'python-jinja')
makedepends=('python' 'python-setuptools' 'python-build' 'python-installer' 'python-wheel')
license=('BSD')
arch=('any')
source=(https://github.com/kvesteri/sqlalchemy-utils/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha512sums=('ffaff8cb0fc0ae677ecfb41d78160ea4ed4bf82eb33c02f098f71fe7592b194e4b77c829dfc421072d8bd59afdfa1e3bc1895e7b91430270cff196b8a40ec0e1')
b2sums=('f1e009b61e850154e1286b55125d9192547bab40457d4cc84ded2c6756e2f13a48a5171a846d88f9484a99a29728bfca5c1d7e6a7699d1688a18b7babeabeb28')

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

check() {
  cd ${_name}-${pkgver}
  # Tests require a postgres and MySQL db
  export PYTHONWARNINGS="ignore"
  pytest -Wignore --disable-pytest-warnings tests/test_models.py
}

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

# vim: ts=2 sw=2 et:
