# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=py3-qrcode
pkgver=7.4.2
pkgrel=3
pkgdesc="QR code image generator"
url="https://github.com/lincolnloop/python-qrcode"
arch="noarch"
license="BSD-3-Clause"
depends="py3-pillow py3-pypng py3-setuptools"
makedepends="py3-gpep517 py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-doc $pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/q/qrcode/qrcode-$pkgver.tar.gz
	no-typing-extensions.patch
	python-3.12.patch
	assert-has_calls.patch
	"
builddir="$srcdir/qrcode-$pkgver"

replaces="py-qrcode" # Backwards compatibility
provides="py-qrcode=$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

	mkdir -vp MagicMock/stdout.buffer
	.testenv/bin/python3 -m pytest
}

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

	install -Dvm644 doc/qr.1 -t "$pkgdir"/usr/share/man/man1/
}

sha512sums="
a8642845990341034e39c43ef674f5b4ce8d3175a44d6062f711af2c24ffd45bda5f3ecf8a7825b7ebafe734b6396d52a37bb59177c544f921e43eaa9f1f5405  qrcode-7.4.2.tar.gz
69b2f48990b50408505ef273244aa0ee070411870d8f930170639c9371f0b595faefddb563c6a367b595d3070b2f2353758d74df82310a0ad72e8c5222957c76  no-typing-extensions.patch
23a9856dc67ea06c4b05ecdc4feb7d008b79409e20e27944b73021aa7897984227ae2e1feeabfc0ea42e6672e7dd666ddac71d1b6eb9e5907d6348be7384a5b3  python-3.12.patch
a6c6b1f4795dc9ab7fd1207002a7ccdf1fdf194323d9b063d91df9df388281d4e2a9d2ca081dd40517508430cf42e7823a47f16760200e611fc501a01ec7150e  assert-has_calls.patch
"
