Subject: [alpine-aports] [PATCH] testing/py-pystache: add python 3 package

From: Drew DeVault <[email-masked]>
Date: Sat, 20 Jan 2018 10:37:28 -0500

---
 testing/py-pystache/APKBUILD | 63 ++++++++++++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 22 deletions(-)

diff --git a/testing/py-pystache/APKBUILD b/testing/py-pystache/APKBUILD
index d42d93073a..a3575caee0 100644
--- a/testing/py-pystache/APKBUILD
+++ b/testing/py-pystache/APKBUILD
@@ -1,40 +1,59 @@
 # Contributor: Paul Kilar <[email-masked]>
 # Maintainer: Paul Kilar <[email-masked]>
 pkgname=py-pystache
-_realname=pystache
-pkgver='0.5.3'
+_pkgname=pystache
+pkgver=0.5.4
 pkgrel=0
 pkgdesc="Pystache is a Python implementation of Mustache."
 url="https://pypi.python.org/pypi/pystache"
 arch="noarch"
 license="MIT"
-depends="python2"
-depends_dev=""
-makedepends="py-setuptools"
-install=""
-subpackages=""
-source="https://files.pythonhosted.org/packages/source/${_realname:0:1}/$_realname/$_realname-$pkgver.tar.gz"
-_builddir="$srcdir"/$_realname-$pkgver
+makedepends="python2-dev py-setuptools python3-dev py2-unittest2"
+subpackages="py3-$_pkgname:_py3 py2-$_pkgname:_py2"
+source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
+builddir="$srcdir"/$_pkgname-$pkgver
 
 prepare() {
-	local i
-	cd "$_builddir"
-	for i in $source; do
-		case $i in
-		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
-		esac
-	done
+	cd "$srcdir"
+	cp -r "$_pkgname-$pkgver" "$_pkgname-$pkgver"-py3
 }
 
 build() {
-	cd "$_builddir"
+	cd "$builddir"
 	python2 setup.py build || return 1
+	cd "$builddir"-py3
+	python3 setup.py build || return 1
+}
+
+check() {
+	cd "$builddir"
+	# pystache tests are python 2 only
+	python -m unittest discover -s pystache
 }
 
 package() {
-	cd "$_builddir"
-	python2 setup.py install --prefix=/usr --root="$pkgdir" || return 1
+	mkdir -p "$pkgdir"
 }
-md5sums="32beedc4ee01cca737ae8f05e65fb53f  pystache-0.5.3.tar.gz"
-sha256sums="445c8663291abf11305693ecac7b9f3ff976555f5506ccc05a0353260a5a16dc  pystache-0.5.3.tar.gz"
-sha512sums="2b77f3e26cf37e663b7414e5ca95667f8332bb1005ae835775543c0d2c282f0c7bd8ded3f1e06da930247e39e5d206fb3f90d80e7c556b98cd69d4be74836843  pystache-0.5.3.tar.gz"
+
+_py2() {
+	replaces="$pkgname"
+	depends="${depends//py-/py2-}"
+	cd "$builddir"
+	_py python2
+}
+
+_py3() {
+	depends="${depends//py-/py3-}"
+	cd "$builddir"-py3
+	_py python3
+}
+
+_py() {
+	local 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="4ac325e1431f58f740218c9ec309821db82d89989ef4ca7fc3536dea0ef1c90e8e85ebaa7df27f33129ca02252b84bcbd7429a1ed999b496f62f174dd66502cb  pystache-0.5.4.tar.gz"
-- 
2.15.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---