# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Carlo Landmeter <clandmeter@alpinelinux.org>
pkgname=py3-pathlib2
pkgver=2.3.7
_pkgver=$pkgver-post1
pkgrel=4
pkgdesc="Fork of pathlib aiming to support the full stdlib Python API"
url="https://github.com/jazzband/pathlib2"
arch="noarch"
license="MIT"
depends="python3 py3-six"
makedepends="py3-setuptools py3-gpep517 py3-wheel"
checkdepends="python3-tests"
subpackages="$pkgname-pyc"
source="pathlib2-$_pkgver.tar.gz::https://github.com/jazzband/pathlib2/archive/$_pkgver.tar.gz
	fix-tests.patch"
builddir="$srcdir/pathlib2-$_pkgver"

replaces="py-pathlib2" # Backwards compatibility
provides="py-pathlib2=$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 --no-compile .dist/*.whl
	PYTHONPATH="tests" .testenv/bin/python3 -m unittest -v tests/test_*.py
}

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

sha512sums="
8eef6dcbd4b264365499ad0b53321fb1dce3b56377e91288a9d2b769775f9d697736e1136fe43d17147b8539fdad666e9b1f5fc22ecc63a601ce87434ba6aab1  pathlib2-2.3.7-post1.tar.gz
9fe020f6d7a34243a2d1cf1512dd57d38ed56cb70d1f8670b22d50f9915b122e87eb374d488cf26178204e1c742c1f5ff905b1ffa894be56a2e93321f954f821  fix-tests.patch
"
