Mail archive
alpine-aports

[alpine-aports] [PATCH 7/8] testing/py-matplotlib: Add support for python3

From: Ivan Tham <pickfire_at_riseup.net>
Date: Mon, 8 May 2017 00:59:14 +0800

---
 testing/py-matplotlib/APKBUILD | 63 ++++++++++++++++++++++++++++++++++--------
 1 file changed, 51 insertions(+), 12 deletions(-)
diff --git a/testing/py-matplotlib/APKBUILD b/testing/py-matplotlib/APKBUILD
index 36cff4233c..8f8ebe469d 100644
--- a/testing/py-matplotlib/APKBUILD
+++ b/testing/py-matplotlib/APKBUILD
_at_@ -8,34 +8,73 @@ pkgdesc="A Python library for plots"
 url="http://matplotlib.org"
 arch="all"
 license="custom"
-depends="python2 py-numpy python2-tkinter py-dateutil py-parsing py-tz py-cycler"
-makedepends="python2-dev gfortran py-numpy-dev freetype-dev libpng-dev tk-dev
-	py-setuptools"
-subpackages="$pkgname-doc $pkgname-tests"
+depends="py-numpy py-dateutil py-parsing py-tz py-cycler"
+makedepends="gfortran py-numpy-dev freetype-dev libpng-dev tk-dev
+	python2-dev python3-dev py-setuptools"
+subpackages="py2-$_pkgname:_py2 py3-$_pkgname:_py3 $pkgname-doc
+	py2-$_pkgname-tests:_py2t:noarch py3-$_pkgname-tests:_py3t:noarch"
 source="$_pkgname-$pkgver.tar.gz::https://github.com/matplotlib/$_pkgname/archive/v$pkgver.tar.gz"
 builddir="$srcdir/$_pkgname-$pkgver"
 
 build() {
 	cd "$builddir"
 	python2 setup.py build || return 1
+	python3 setup.py build || return 1
+}
+
+check() {
+	cd "$builddir"
+	python2 setup.py check || return 1
+	python3 setup.py check || return 1
 }
 
 package() {
+	mkdir -p "$pkgdir"
+	install -m755 -d "$pkgdir"-doc/usr/share/licenses/custom/$pkgname
+	install -m644 "$builddir"/LICENSE/* \
+		"$pkgdir"-doc/usr/share/licenses/custom/$pkgname/
+}
+
+_py() {
+	local python="$1"
+	pkgdesc="$pkgdesc (for $python)"
+	depends="$depends $python"
+	install_if="$pkgname=$pkgver-r$pkgrel $python"
+
 	cd "$builddir"
+	$python setup.py install --prefix=/usr --root="$subpkgdir" || return 1
+}
 
-	python2 setup.py install --prefix=/usr --root="$pkgdir" || return 1
-	install -m755 -d "$pkgdir"/usr/share/licenses/custom/$pkgname
-	install -m644 LICENSE/* "$pkgdir"/usr/share/licenses/custom/$pkgname/
+_py2() {
+	replace="$pkgname"
+	depends="${depends//py-/py2-} python2-tkinter"
+	_py python2
 }
 
-tests() {
-	pkgdesc="$pkgdesc (tests)"
-	arch="noarch"
+_py3() {
+	depends="${depends//py-/py3-} python3-tkinter"
+	_py python3
+}
+
+_tests() {
+	local python="$1"
+	local sitepath="$($python -c 'import site; print(site.getsitepackages()[0])')/$_pkgname"
+
+	pkgdesc="$pkgdesc ($python tests)"
 	depends="$depends py-nose"
-	local sitepath="$(python2 -c 'import site; print(site.getsitepackages()[0])')/$_pkgname"
 
 	mkdir -p "$subpkgdir"$sitepath
-	mv "$pkgdir"$sitepath/tests "$subpkgdir"$sitepath/
+	mv "${subpkgdir%-tests}"$sitepath/tests "$subpkgdir"$sitepath/
+}
+
+_py2t() {
+	depends="${depends//py-/py2-} py2-nose"
+	_tests python2
+}
+
+_py3t() {
+	depends="${depends//py-/py3-} py3-nose"
+	_tests python3
 }
 
 md5sums="b22dc4962f36aab919a7125b3b35953b  matplotlib-1.5.1.tar.gz"
-- 
2.12.2
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Mon May 08 2017 - 00:59:14 UTC