# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py3-voluptuous
_pkgname=voluptuous
pkgver=0.15.2
pkgrel=0
pkgdesc="Python data validation library"
url="https://github.com/alecthomas/voluptuous"
license="BSD-3-Clause"
arch="noarch"
depends="python3"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

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

prepare() {
	default_prepare
	# https://github.com/alecthomas/voluptuous/issues/333
	rm -rf ./*.egg-info
}

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 voluptuous/tests/tests.py
}

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

sha512sums="
7549de7632f112979115f1bdc3ab895c1077ea9b8550a237d75168c61b429e6c7219deeb12c07ddc9d3c08cbf9280d741be1e4a3794608136899604a38e075cd  voluptuous-0.15.2.tar.gz
"
