# Contributor: Duncan Bellamy <dunk@denkimushi.com>
# Maintainer: Duncan Bellamy <dunk@denkimushi.com>
pkgname=py3-dns-lexicon
pkgver=3.21.1
pkgrel=0
pkgdesc="Manipulate DNS records on various DNS providers in a standardized/agnostic way"
url="https://github.com/dns-lexicon/dns-lexicon"
arch="noarch"
license="MIT"
#tests need net access
options="net"
depends="
	py3-beautifulsoup4
	py3-cryptography
	py3-dnspython
	py3-otp
	py3-requests
	py3-tldextract
	py3-yaml
	"
makedepends="py3-gpep517 py3-hatchling py3-poetry-core"
_providerdepends="
	py3-boto3
	py3-localzone
	py3-oci
	py3-softlayer
	py3-softlayer-zeep
	py3-xmltodict
	"
checkdepends="
	py3-pytest
	py3-pytest-xdist
	py3-vcrpy
	$_providerdepends
	"
subpackages="$pkgname-pyc"
source="$pkgname-github-$pkgver.tar.gz::https://github.com/dns-lexicon/dns-lexicon/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/dns-lexicon-$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
	# auto and namecheap tests fail in rootbld
	# godaddy has vcrpy overwrite existing cassete errors
	.testenv/bin/python3 -m pytest \
		--ignore tests/providers/test_localzone.py \
		--ignore tests/providers/test_auto.py \
		--ignore tests/providers/test_godaddy.py \
		--ignore tests/providers/test_namecheap.py
}

package() {
	python3 -m installer -d "$pkgdir" .dist/*.whl
	rm -rf "$pkgdir"/usr/lib/python3*/site-packages/lexicon/tests
}

sha512sums="
0f53001edf2425afe7b7c4315e974ee47c956b659964998b942943788711c57634eea2d7974e21005be7f0edf16800e6577c49c8789e34f2133c4f5be8ac7ac1  py3-dns-lexicon-github-3.21.1.tar.gz
"
