# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=py3-tqdm
pkgver=4.66.5
pkgrel=0
pkgdesc="Fast, Extensible Progress Meter"
url="https://pypi.org/project/tqdm"
arch="noarch"
license="MIT"
makedepends="
	py3-gpep517
	py3-setuptools_scm
	py3-wheel
	"
checkdepends="
	py3-pandas
	py3-pytest
	py3-pytest-asyncio
	py3-pytest-timeout
	"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/t/tqdm/tqdm-$pkgver.tar.gz"
builddir="$srcdir/tqdm-$pkgver"

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

# secfixes:
#   4.66.4-r0:
#     - CVE-2024-34062

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

	# 30s timeout
	case "$CARCH" in
	riscv64)
		.testenv/bin/python3 -m pytest \
			--ignore tests/tests_perf.py
		;;
	*)
		.testenv/bin/python3 -m pytest \
			--deselect tests/tests_perf.py::test_lock_args
		;;
	esac
}

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

	ln -s tqdm "$pkgdir"/usr/bin/tqdm-3
}

sha512sums="
8e2c35f02fe365063a325d8a1d3e525870d522fab465e1a86764b8716ff32c039db463fe5e74a5f080ced40851d49b1e4273126074d62f14ed1935a96e0afb8a  tqdm-4.66.5.tar.gz
"
