# Maintainer: Will Sinatra <wpsinatra@gmail.com>
pkgname=py3-docformatter
pkgver=1.7.5
pkgrel=3
pkgdesc="Formats docstrings to follow PEP 257"
url="https://github.com/PyCQA/docformatter"
arch="noarch"
license="MIT"
depends="
	py3-charset-normalizer
	py3-untokenize
	"
makedepends="
	py3-gpep517
	py3-poetry-core
	"
checkdepends="
	black
	py3-mock
	py3-pytest-forked
	py3-pytest-xdist
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/PyCQA/docformatter/archive/refs/tags/v$pkgver.tar.gz
	fix-tests.patch
	"
builddir="$srcdir/docformatter-$pkgver"

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
	(
		# shellcheck disable=1091
		. .testenv/bin/activate
		# dumb checks that seems to fail to add a space or whatever
		.testenv/bin/python3 -m pytest -n auto --forked \
			--deselect=tests/test_docformatter.py \
			--deselect=tests/test_configuration_functions.py
	)
}

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

sha512sums="
bb3e7674845632be7b75151a874987582f7cba2682905b0527a1bb8cda37156931ade35cb712ffba91d510e89a45474d5df8f41bea6979cc933f7ec999cf01f4  py3-docformatter-1.7.5.tar.gz
a9f9a970b74c8a353df99ba3b005197562f4a320a5f38913cfafb1d13c2f45a6ce1aa5899ed219e72cc52a5c3ca3b690cee029a7b13f13768952c239ca2a0d87  fix-tests.patch
"
