# 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.38.3
pkgrel=4
pkgdesc='Various utility functions, new data types and helpers for SQLAlchemy'
url='https://github.com/kvesteri/sqlalchemy-utils'
depends=('python' 'python-sqlalchemy' 'python-anyjson' '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=('d6790cc9df0424f528f066e9d9302beb9ed16ba50370878d387796b4adaec5e19466e6093b5758c189735db1f1d210a4a17579ec31a7d38df5c91f04a215ff71')
b2sums=('162a01e67b14f419723ef698b389de1ca427f01da3a005878838755468691c8e0c2c8ca347e064940c6ef41fd0c2e1f0651cacf620407073e85cecc38b392a64')

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:
