# Contributor: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
# Maintainer: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
pkgname=py3-cads-api-client
pkgver=1.5.4
pkgrel=0
pkgdesc="CADS API Python client for developing and testing"
url="https://github.com/ecmwf-projects/cads-api-client"
arch="noarch"
license="Apache-2.0"
depends="py3-attrs py3-multiurl py3-requests py3-responses py3-typing-extensions"
makedepends="py3-gpep517 py3-setuptools_scm py3-wheel"
checkdepends="py3-pytest-xdist"
subpackages="$pkgname-pyc"
source="https://github.com/ecmwf-projects/cads-api-client/archive/v$pkgver/cads-api-client-$pkgver.tar.gz"
builddir="$srcdir/cads-api-client-$pkgver"

build() {
	export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
	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 -n auto
}

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

sha512sums="
c6b59194e56f6878eadd56f21f1a17ce408e279df5e43275a20a3b89269f8f6aacf068b7061962c95adbc065c4239c4f3111aacea63e97aba379d4cadabf7822  cads-api-client-1.5.4.tar.gz
"
