# Contributor: Simon Rupf <simon@rupf.net>
# Contributor: Philipp Glaum <p@pglaum.de>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=py3-flask-sqlalchemy
_pkgname=flask_sqlalchemy
pkgver=3.1.1
pkgrel=1
pkgdesc="Adds SQLAlchemy support to your Flask application."
url="https://pypi.org/project/Flask-SQLAlchemy/"
arch="noarch"
license="BSD-3-Clause"
depends="py3-flask py3-greenlet py3-sqlalchemy"
makedepends="py3-gpep517 py3-flit-core"
checkdepends="py3-pytest py3-mock"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz
	python-3.12.patch
	tests-skip-table-binding.patch"
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
}

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

sha512sums="
27a93efb96bc8afe483dc32f9e9756e5972029464f4a201e8a55bf62b88f6bcd93ed7f4472ac21cb17376c87852a1d4b5f98a8ddb55d9b12c334346d5bc7e464  flask_sqlalchemy-3.1.1.tar.gz
73ec31ca3c78081b6c73fcf28dc2c5fe063104a3352b2f51bfe8a70106c85c1df8b90b7a1529cd7bc55e1a5fcb0ee1e043524afe7a1b7d4c97b130def3803a27  python-3.12.patch
63f322f77052312fe2abd268a9fc50075f6696e109aa7e4e018e3fd2f8fcccd1d1669eb59a38a94822824196d5124577d5b2a1174fd924e33f10dd79fa23b6ac  tests-skip-table-binding.patch
"
