# Contributor: Sean McAvoy <seanmcavoy@gmail.com>
# Maintainer: Sean McAvoy <seanmcavoy@gmail.com>
pkgname=py3-subprocess-tee
pkgver=0.4.2
pkgrel=0
pkgdesc="subprocess.run drop-in replacement that supports a tee mode"
url="https://github.com/pycontribs/subprocess-tee"
arch="noarch"
license="MIT"
depends="python3 py3-enrich"
makedepends="py3-setuptools py3-setuptools_scm py3-gpep517 py3-installer py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/s/subprocess_tee/subprocess_tee-$pkgver.tar.gz"
builddir="$srcdir/subprocess_tee-$pkgver"

case "$CARCH" in
s390x) options="$options !check" ;;
esac

build() {
	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/subprocess_tee*.whl
	.testenv/bin/python3 -m pytest -k 'not test_molecule and not test_rich_console_ex'
}

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

sha512sums="
acb0103b8a9ba6288e42148062e82b37b625f5c518e195c4d6e32efd2d5d9841ac6f2c2b240d223e7cdecc643daaa3d86c63a6bc34ca7b48e187cbf968e5dae5  subprocess_tee-0.4.2.tar.gz
"
