# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-argcomplete
_pyname=argcomplete
pkgver=3.5.0
pkgrel=0
pkgdesc="Easy, extensible command line tab completion of arguments for your Python script"
url="https://github.com/kislyuk/argcomplete"
arch="noarch"
license="Apache-2.0"
makedepends="py3-setuptools py3-gpep517 py3-wheel py3-installer py3-setuptools_scm"
checkdepends="py3-pexpect bash fish tcsh"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/kislyuk/$_pyname/archive/v$pkgver.tar.gz
	disable-zsh-tests.patch
	skip-pip.patch
	"
builddir="$srcdir/$_pyname-$pkgver"
options="!check" # fail with ebadf on the builders for some reason

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

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
	.testenv/bin/python3 test/test.py -v
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/argcomplete*.whl
	rm -rf "$pkgdir"/usr/lib/python3.11/site-packages/test/
}

sha512sums="
dac71aa67a77bca39928f68570875842a7e94f8fb2910dee92401d8377d84f9f45c8f6ed6866629f2dc1654628838208f69d3371f28eb99937b022d3af6e3903  py3-argcomplete-3.5.0.tar.gz
cc3aa820a255a6ccd9aee0f3a3bf369a93d3e01d80e3586ad839f45405907a64a74e485669f43811ae708d18047c8f8387fa7199d3e67b5c021df04cb10e9a91  disable-zsh-tests.patch
3c48d5c07619fe36cff9235864c5e7ef2f0703d39c66bb40d9149cd16b72dfcc978e70a95695dcbdfc241f8241f16d387e087f22e35bd180010126b9b8d738bd  skip-pip.patch
"
