# Contributor: Peter Bui <pnutzh4x0r@gmail.com>
# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: fossdd <fossdd@pwned.life>
pkgname=py3-flake8
pkgver=7.1.1
pkgrel=0
pkgdesc="Modular source code checker"
url="https://github.com/PyCQA/flake8"
arch="noarch"
license="MIT"
depends="
	py3-pyflakes
	py3-pycodestyle
	py3-mccabe
	"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="
	py3-pytest
	py3-pbr
	py3-atomicwrites
	py3-attrs
	py3-pluggy
	py3-six
	py3-mock
	"
subpackages="$pkgname-pyc"
source="https://github.com/PyCQA/flake8/archive/refs/tags/$pkgver/py3-flake8-$pkgver.tar.gz"
builddir="$srcdir/flake8-$pkgver"
options="net"

replaces="py-flake8" # Backwards compatibility
provides="py-flake8=$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 setup.py install
	testenv/bin/python3 -m pytest -v \
		--deselect=tests/integration/test_api_legacy.py::test_legacy_api \
		--deselect=tests/integration/test_main.py \
		--deselect=tests/integration/test_plugins.py \
		--deselect=tests/unit/test_setuptools_command.py::test_package_files_removes_submodules \
		--deselect=tests/unit/plugins/pycodestyle_test.py::test_up_to_date
}

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

sha512sums="
310457e3c701f746d812cc76664bcb79c7cbc320af9d757ebbc13c847f2c3864770d9b945694b4b6abb773ae636e19175222c3dab74d34559beaa7835f1d9931  py3-flake8-7.1.1.tar.gz
"
