# Contributor: Aiden Grossman <agrossman154@yahoo.com>
# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=py3-pyinstrument
pkgver=5.0.2
pkgrel=0
pkgdesc="Call stack profiler for Python"
url="https://github.com/joerick/pyinstrument"
arch="all"
license="BSD-3-Clause"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3-dev
	"
checkdepends="
	py3-flaky
	py3-greenlet
	py3-pytest
	py3-pytest-asyncio
	py3-trio
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/joerick/pyinstrument/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/pyinstrument-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	[ -d "pyinstrument" ] && mv -v pyinstrument pyinstrument.src

	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl

	# test_cmdline.py tries to run "pyinstrument" executable
	PATH="$builddir/.testenv/bin:$PATH" .testenv/bin/python3 -m pytest
}

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

sha512sums="
7eeb0e05ceb31eab6b4cfcfae7095e7fe9399a7292a12ea427c6ce4f343b1f85be60496c071c2a983b9d0b40f76e18140a836b77a6df0765e40779758212d4cf  py3-pyinstrument-5.0.2.tar.gz
"
