# Maintainer: Michał Adamski <michal@ert.pl>
pkgname=electrum
pkgver=4.5.4
pkgrel=1
pkgdesc="Lightweight Bitcoin Wallet"
url="https://electrum.org/"
arch="noarch"
license="MIT"
depends="
	libsecp256k1
	py3-aiohttp
	py3-aiohttp-socks
	py3-aiorpcx
	py3-attrs
	py3-bitstring
	py3-certifi
	py3-dnspython
	py3-ecdsa
	py3-jsonpatch
	py3-protobuf
	py3-pycryptodomex
	py3-qrcode
	"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="py3-pytest-xdist py3-cryptography py3-pyaes"
subpackages="$pkgname-pyc"
source="
	electrum-$pkgver.tar.gz::https://github.com/spesmilo/electrum/archive/refs/tags/$pkgver.tar.gz
	0001-apk-add-instead-of-apt-get-install.patch
"

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 -n auto \
		--ignore tests/test_qml_types.py \
		tests
}

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

sha512sums="
3fda9a931067e35d8bc11da8855553a1208428975fe65b0fc20eb26bdd2c3840b5c3ed4261e60344c7256461887d286e432568ef385d9c6b1216e708e099b34b  electrum-4.5.4.tar.gz
797f684a8df30176129335e9e09868be8a4db7a76b3b89dd0b48d93e577a90aa378839a7cc2bf7804494e1cfea77e392fcf74d55243ad51531f4e42c6c747aac  0001-apk-add-instead-of-apt-get-install.patch
"
