# Contributor: Peter Bui <pnutzh4x0r@gmail.com>
# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: fossdd <fossdd@pwned.life>
pkgname=py3-flake8
pkgver=7.2.0
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="
8478b463aa84cdfb8144fb20db03116593e21cc4ec7dee2b87ac7edcb67cb00ae181a51117c885363f1050a83db5a91a65d52c3d8d80affb0a5e526e56792f26  py3-flake8-7.2.0.tar.gz
"
