Mail archive
alpine-aports

[alpine-aports] [PATCH 08/12] py-hypothesis: adopt, normalize APKBUILD

From: Drew DeVault <sir_at_cmpwn.com>
Date: Wed, 3 Apr 2019 16:27:11 -0400

Note that the old APKBUILD did not actually run any tests, but the fixed
check() runs into tests which appear to be broken upstream.
---
 main/py-hypothesis/APKBUILD | 47 +++++++++++++++++++++++--------------
 1 file changed, 29 insertions(+), 18 deletions(-)
diff --git a/main/py-hypothesis/APKBUILD b/main/py-hypothesis/APKBUILD
index 783aaab202..06adfb4eab 100644
--- a/main/py-hypothesis/APKBUILD
+++ b/main/py-hypothesis/APKBUILD
_at_@ -1,4 +1,4 @@
-# Maintainer: Natanael Copa <ncopa_at_alpinelinux.org>
+# Maintainer: Drew DeVault <sir_at_cmpwn.com>
 pkgname=py-hypothesis
 pkgver=4.14.3
 pkgrel=0
_at_@ -6,46 +6,57 @@ pkgdesc="Advanced property-based (QuickCheck-like) testing for Python"
 url="http://hypothesis.works/"
 arch="noarch"
 license="MPL-2.0"
-depends="py-coverage"
 _py2_deps="py2-coverage"
 _py3_deps="py3-coverage"
 makedepends="
 	$_py2_deps $_py3_deps python2-dev python3-dev py2-setuptools py3-setuptools
 	py-enum34
 "
-subpackages="py2-hypothesis:_py py3-hypothesis:_py"
+subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3"
 source="py-hypothesis-$pkgver.tar.gz::https://github.com/HypothesisWorks/hypothesis-python/archive/hypothesis-python-$pkgver.tar.gz"
 builddir="$srcdir/hypothesis-hypothesis-python-$pkgver/hypothesis-python"
+options="!check" # upstream tests are broken
+
+prepare() {
+	cp -r "$builddir" "$builddir"-py2
+}
 
 build() {
 	cd "$builddir"
-	python2 setup.py build
 	python3 setup.py build
+	cd "$builddir"-py2
+	python2 setup.py build
 }
 
 check() {
 	cd "$builddir"
-	python2 setup.py check
-	python3 setup.py check
+	python3 setup.py test
+	cd "$builddir"-py2
+	python2 setup.py test
 }
 
 package() {
+	mkdir -p "$pkgdir"
+}
+
+_py2() {
+	depends="$_py2_deps"
+	cd "$builddir"-py2
+	_py python2
+}
+
+_py3() {
+	depends="$_py3_deps"
 	cd "$builddir"
-	python2 setup.py install --prefix=/usr --root="$pkgdir"
-	python3 setup.py install --prefix=/usr --root="$pkgdir"
+	_py python3
 }
 
 _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/
+	_python="$1"
+	pkgdesc="$pkgdesc (for $_python)"
+	depends="$depends $_python"
+	install_if="$pkgname=$pkgver-r$pkgrel $_python"
+	$_python setup.py install --prefix=/usr --root="$subpkgdir"
 }
 
 sha512sums="56f0a796741b1a46bfe91e578dc76067b612d0041dd8b93043521c8e53827a5bcdd815f94e91d22d4ae9d13125bfb9012cb1c4660635e7cc93472141be504efb  py-hypothesis-4.14.3.tar.gz"
-- 
2.21.0
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Wed Apr 03 2019 - 16:27:11 UTC