# Contributor: Paul Kilar <pkilar@gmail.com>
# Maintainer: Paul Kilar <pkilar@gmail.com>
pkgname=py3-bottle
_pkgname=bottle
pkgver=0.12.25
pkgrel=2
pkgdesc="fast, simple and lightweight WSGI micro web-framework"
options="!check" # failures=1
url="https://bottlepy.org/docs/dev"
arch="noarch"
license="MIT"
depends="python3"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

# secfixes:
#   0.12.21-r0:
#     - CVE-2022-31799

replaces="py-bottle" # Backwards compatibility
provides="py-bottle=$pkgver-r$pkgrel" # Backwards compatibility

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 unittest discover test
}

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

sha512sums="
14b8ed1ffd58f9667d451872ccf73a6f4bf8f7ffb9329f55314f90c770630cfe3f9956f786bcc7fd5f67fde22d14961952969af405912ebe71f019ca6599c975  bottle-0.12.25.tar.gz
"
