# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=py-hypothesis
pkgver=3.38.0
pkgrel=1
pkgdesc="Advanced property-based (QuickCheck-like) testing for Python"
url="http://hypothesis.works/"
arch="noarch"
license="MPL-2.0"
depends=""
makedepends="py-setuptools python2-dev python3-dev py-enum34"
install=""
subpackages="py2-hypothesis:_py py3-hypothesis:_py"
source="py-hypothesis-$pkgver.tar.gz::https://github.com/HypothesisWorks/hypothesis-python/archive/$pkgver.tar.gz"
builddir="$srcdir/hypothesis-python-$pkgver"

build() {
	cd "$builddir"
	python2 setup.py build
	python3 setup.py build
}

check() {
	cd "$builddir"
	python2 setup.py check
	python3 setup.py check
}

package() {
	cd "$builddir"
	python2 setup.py install --prefix=/usr --root="$pkgdir"
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

_py() {
	local py=${subpkgname%%-*}
	local python="python${py#py}"
	depends="$python"
	case $py in
		py2) depends="$depends py-enum34";;
	esac
	pkgdesc="$pkgdesc ($python)"
	install_if="$pkgname=$pkgver-r$pkgrel $python"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/${python}* "$subpkgdir"/usr/lib/
}

sha512sums="9001b045013f720885e53649c9445ac12c149e609b2532fc52ed2b4743aad59a2a59d6775988f65a23b58983a726849d75c368d291662c4b1d62e5d769efe88e  py-hypothesis-3.38.0.tar.gz"
