# Contributor: Thomas Boerger <thomas@webhippie.de>
# Maintainer: Thomas Boerger <thomas@webhippie.de>
pkgname=py3-wcwidth
_pkgname=wcwidth
pkgver=0.2.13
pkgrel=1
pkgdesc="Measures number of Terminal column cells of wide-character codes"
url="https://pypi.org/project/wcwidth"
arch="noarch"
license="MIT"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest-cov"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="py-wcwidth" # Backwards compatibility
provides="py-wcwidth=$pkgver-r$pkgrel" # Backwards compatibility
# circular dependency on pytest
options="$options !check"

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/*.whl
	.testenv/bin/python3 -m pytest
}

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

sha512sums="
1eadda149936cf2eefe5d09c411774dc87c8a358f2dd92d74f427d7b47f07c05557e849c46122d44788c2bd7c97eb85fc5f902d9a158d68ab9e352c5185ba2d5  wcwidth-0.2.13.tar.gz
"
