# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Contributor: Keith Maxwell <keith.maxwell@gmail.com>
maintainer="fossdd <fossdd@pwned.life>"
pkgname=py3-pycodestyle
_pkgname=pycodestyle
pkgver=2.13.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="
6e1ba1586b62a9ba3b63f2c67b9b98ee787785fffc29897a68d6dd138d226f5fc490a555ad11f4ca2a8c46082ad5ce8ea1c904c12183005abe4347ca80ca63be  py3-pycodestyle-2.13.0.tar.gz
"
