# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Keith Maxwell <keith.maxwell@gmail.com>
pkgname=py3-pycodestyle
_pkgname=pycodestyle
pkgver=2.12.0
pkgrel=0
pkgdesc="Check your Python code against some of the style conventions in PEP 8"
url="https://pypi.org/project/pycodestyle/"
arch="noarch"
license="MIT"
depends="python3"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/PyCQA/$_pkgname/archive/$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

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

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() {
	mkdir -p "$pkgdir"/usr/bin
	ln -s pycodestyle "$pkgdir"/usr/bin/pycodestyle-3

	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
903dd24113c1757826e31564ebac0ac97ad457b84d292f2f1e798df8e68a3847ff6fed0739430d29becc4a52ba4032d873b0212c13d007695df601637b69bdba  py3-pycodestyle-2.12.0.tar.gz
"
