Subject: [alpine-aports] [PATCH] testing/py-ansi2html: 1.5.2; modernize APKBUILD

From: Drew DeVault <[email-masked]>
Date: Mon, 11 Mar 2019 13:00:41 -0600

---
 testing/py-ansi2html/APKBUILD | 53 +++++++++++++++++++++++++++--------
 1 file changed, 41 insertions(+), 12 deletions(-)

diff --git a/testing/py-ansi2html/APKBUILD b/testing/py-ansi2html/APKBUILD
index af152cd7c5..6953d1fe63 100644
--- a/testing/py-ansi2html/APKBUILD
+++ b/testing/py-ansi2html/APKBUILD
@@ -2,29 +2,58 @@
 # Maintainer: Fabian Affolter <[email-masked]>
 pkgname=py-ansi2html
 _pkgname=ansi2html
-pkgver=1.3.0
+pkgver=1.5.2
 pkgrel=0
 pkgdesc="Convert text with ANSI color codes to HTML"
 url="http://github.com/ralphbean/ansi2html/"
 arch="noarch"
-license="GPL-3.0-or-later"
-depends="python2 py-setuptools py-six"
-depends_dev=""
-makedepends="python2-dev"
-install=""
-subpackages=""
-source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
-
+license="LGPL-3.0-or-later"
+depends="py-six"
+makedepends="py-setuptools"
+checkdepends="py-nose py-mock py2-pytest pytest"
+source="$pkgname-$pkgver.tar.gz::https://github.com/ralphbean/$_pkgname/archive/$pkgver.tar.gz"
 builddir="$srcdir"/$_pkgname-$pkgver
+options="!check" # upstream tests don't work unless module is installed
+
+prepare() {
+	cp -r "$builddir" "$builddir"-py3
+}
 
 build() {
 	cd "$builddir"
-	python2 setup.py build || return 1
+	PYTHONPATH="$(pwd)" python2 ./tests/test_ansi2html.py
+	cd "$builddir"-py3
+	PYTHONPATH="$(pwd)" python3 ./tests/test_ansi2html.py
+}
+
+check() {
+	cd "$builddir"
+	pytest-2
+	cd "$builddir"-py3
+	pytest-3
 }
 
 package() {
+	mkdir -p "$pkgdir"
+}
+
+_py2() {
 	cd "$builddir"
-	python2 setup.py install --prefix=/usr --root="$pkgdir" || return 1
+	replaces="py-ansi2html"
+	_py python2
+}
+
+_py3() {
+	cd "$builddir"-py3
+	_py python3
+}
+
+_py() {
+	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="73d1b3431e22146c4fe18fef4b05413231d79d627c396d67528d0aa1ab07a7ef4bcfeff56829b85d9fe9ad508599b782318911f7b10d6b9a1bc98780e31389d7  ansi2html-1.3.0.tar.gz"
+sha512sums="d386502d755a393a8de2f9c37ac2f1d6cfad1ac5dd3c1e508fe42a72a49762d43546d474e9ad7def5c89b5d7466ae7dceb331c46e2be6cfc4d1f6896a278dce2  py-ansi2html-1.5.2.tar.gz"
-- 
2.21.0

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