# Contributor: Peter Bui <pnutzh4x0r@gmail.com>
# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# NOTE: ensure compatibility with py3-flake8! (#11378)
maintainer="fossdd <fossdd@pwned.life>"
pkgname=py3-pyflakes
pkgver=3.3.2
pkgrel=0
pkgdesc="passive checker of Python programs"
url="https://github.com/PyCQA/pyflakes"
arch="noarch"
license="MIT"
depends="python3"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/p/pyflakes/pyflakes-$pkgver.tar.gz"
builddir="$srcdir/pyflakes-$pkgver"

replaces="py-pyflakes" # Backwards compatibility
provides="py-pyflakes=$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 pyflakes "$pkgdir"/usr/bin/pyflakes-3

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

sha512sums="
1cf65584e77a70a17dea0b66dc3e4e4a202cf6501f0209025eac2ce34925e229b28b6a66e09c536692a6ce5ce895c5b7451dbd6b44dd77994e4c0701653c6251  pyflakes-3.3.2.tar.gz
"
