# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
maintainer="fossdd <fossdd@pwned.life>"
pkgname=py3-isort
pkgver=6.0.1
pkgrel=0
pkgdesc="Python library to sort Python imports"
url="https://github.com/PyCQA/isort"
arch="noarch"
license="MIT"
depends="python3"
makedepends="
	py3-gpep517
	py3-poetry-core
	py3-hatchling
	py3-hatch-vcs
	"
checkdepends="
	black
	py3-hypothesis
	py3-pytest
	py3-colorama
	"
subpackages="$pkgname-pyc"
source="https://pypi.io/packages/source/i/isort/isort-$pkgver.tar.gz"
builddir="$srcdir/isort-$pkgver"
options="!check" # tests git clone random stuff

replaces="py-isort" # Backwards compatibility
provides="py-isort=$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
	# Ignored tests have unmet dependencies
	.testenv/bin/python3 -m pytest \
		--ignore tests/unit/test_pylama_isort.py \
		--ignore tests/integration/test_hypothesmith.py
}

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

sha512sums="
32eb305e59c5e8d18389432fac6c30b769752c756df43d3c15af268e44c9d74cde5ced952b5a25cea93bd9572f3ba203b8409dff9396a95492993875762ee591  isort-6.0.1.tar.gz
"
