# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=py3-tqdm
pkgver=4.67.1
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="
f97d35ff73c9ba92c6cbfc2834cdedcdad2ec1d757ed40220b29d8c8863b197d8d00533e7f2a41589a9f68de1d053cc9715cc8b597759a3dcf96fec192edf4e3  tqdm-4.67.1.tar.gz
"
