# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=py3-sqlalchemy-utils
_pkgname=sqlalchemy-utils
pkgver=0.41.2
pkgrel=0
pkgdesc="Various utility functions and custom data types for SQLAlchemy"
url="https://sqlalchemy-utils.readthedocs.io/"
arch="noarch"
license="BSD-3-Clause"
depends="python3 py3-sqlalchemy"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="
	py3-pytest
	py3-flexmock
	py3-psycopg2
	py3-pymysql
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/kvesteri/sqlalchemy-utils/archive/refs/tags/$pkgver.tar.gz"
# Many checks require test database
# TODO: Figure out how to create user-space pgsql test db
options="!check"
builddir="$srcdir"/$_pkgname-$pkgver

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest -v
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
ffaff8cb0fc0ae677ecfb41d78160ea4ed4bf82eb33c02f098f71fe7592b194e4b77c829dfc421072d8bd59afdfa1e3bc1895e7b91430270cff196b8a40ec0e1  py3-sqlalchemy-utils-0.41.2.tar.gz
"
