# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=py3-future
_pkgname=future
pkgver=1.0.0
pkgrel=1
pkgdesc="Easy, clean, reliable Python 2/3 compatibility"
url="https://python-future.org/"
arch="noarch"
license="MIT"
depends="python3"
# It can be built without it but it misses a lot of functionality
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://pypi.io/packages/source/f/future/future-$pkgver.tar.gz
	test_ftp.patch
	"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="py-future" # Backwards compatibility
provides="py-future=$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
	# https://github.com/PythonCharmers/python-future/issues/647
	.testenv/bin/python3 -m pytest -v -k "not test_isinstance_recursion_limit and not test_subclass_recursion_limit" \
		--ignore tests/test_future/test_urllib.py \
		--ignore tests/test_future/test_urllib_toplevel.py
}

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

sha512sums="
8e28d53172e3ae7b3b27c424a48fb698a6e86bf1c648cdf74e7fd57d34901a9bda18429fe4e176d70be67fc6c80b7f961b3021356594e38b5f294406af40bc61  py3-future-1.0.0.tar.gz
e045ba2f5a3d29ab78b75f6211e4b40ec8333d6fcb53bf09803fedecc0728f929753aa7745eda3275fcbc7087bbe22b1e2df455e6750e80b608fdc2a1a1e67f0  test_ftp.patch
"
