# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-pdm-backend
pkgver=2.4.4
pkgrel=0
pkgdesc="Build backend used by PDM that supports latest packaging standards"
url="https://pdm-backend.fming.dev/"
arch="noarch"
license="MIT"
depends="
	py3-cerberus
	py3-editables
	py3-license-expression
	py3-packaging
	py3-pyproject-metadata
	py3-tomli
	py3-tomli-w
	py3-validate-pyproject
	python3
	"
makedepends="py3-gpep517 py3-installer"
checkdepends="git py3-pytest py3-setuptools python3-dev"
subpackages="$pkgname-pyc"
source="https://github.com/pdm-project/pdm-backend/archive/refs/tags/$pkgver/py3-pdm-backend-$pkgver.tar.gz
	unvendor.patch
	fix-scm-api-tests.patch
	"
builddir="$srcdir/pdm-backend-$pkgver"

build() {
	PDM_BUILD_SCM_VERSION=$pkgver \
	gpep517 build-wheel	\
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

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

	rm -rf "$pkgdir"/usr/lib/python*/site-packages/pdm/backend/_vendor
	find "$pkgdir" -type f -name '*.orig' -delete
}

sha512sums="
b8d6983d2df1028d30c046c9952e6182aed0b099e6d0d0b4cc784179cb3e4c9f518b58a6fe5c7a2d15b150dc134b7dc8c427ea142620e8bb29dd05be1a7efe1a  py3-pdm-backend-2.4.4.tar.gz
56c7875d916c4893e2d0864b1b4d2bc668a30093d1c4572edf6d3754d05201e608ecf19202a97fcd0baac09474960ac2535cf03b265f01ccc65e1104c9871445  unvendor.patch
132a5188a88c13fa9d58fe86c38fa60ae1ebb7c1d6cd35a07679afe028ba9760abfc4668bea71963280e569ddef6d9a8352d4b4dcb88e62609329521d27cdcfb  fix-scm-api-tests.patch
"
