# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-argcomplete
_pyname=argcomplete
pkgver=3.6.2
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-hatchling py3-gpep517 py3-installer py3-hatch-vcs"
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
}

sha512sums="
286fa6b87c8e24e168676221c29a342fc19f1864ecc255aff0fb47590d63e6d846bde3c910395668f50c6fa7c7893a06ebb7015291f320c5a0c8c3ce65c073bf  py3-argcomplete-3.6.2.tar.gz
cc3aa820a255a6ccd9aee0f3a3bf369a93d3e01d80e3586ad839f45405907a64a74e485669f43811ae708d18047c8f8387fa7199d3e67b5c021df04cb10e9a91  disable-zsh-tests.patch
3c48d5c07619fe36cff9235864c5e7ef2f0703d39c66bb40d9149cd16b72dfcc978e70a95695dcbdfc241f8241f16d387e087f22e35bd180010126b9b8d738bd  skip-pip.patch
"
