Patches for aports can be sent to this list

1

[alpine-aports] [PATCH] testing/py-matplotlib: Update to 2.2.2, py3 support

Marian Buschsieweke
Details
Message ID
<20180521213329.13734-1-marian.buschsieweke@ovgu.de>
Sender timestamp
1526938409
DKIM signature
missing
Download raw message
Patch: +39 -20
Added subpackages py2-matplotlib and py3-matplotlib, which provide the python2
and python3 version of matplotlib.
---
 testing/py-matplotlib/APKBUILD | 59 ++++++++++++++++++++++------------
 1 file changed, 39 insertions(+), 20 deletions(-)

diff --git a/testing/py-matplotlib/APKBUILD b/testing/py-matplotlib/APKBUILD
index 45e057e3f6..d71994b560 100644
--- a/testing/py-matplotlib/APKBUILD
+++ b/testing/py-matplotlib/APKBUILD
@@ -2,42 +2,61 @@
 # Maintainer: Isaac Dunham <ibid.ag@gmail.com>
 pkgname=py-matplotlib
 _pkgname=matplotlib
-pkgver=1.5.1
-pkgrel=2
+pkgver=2.2.2
+pkgrel=0
 pkgdesc="A Python library for plots"
 url="http://matplotlib.org"
 arch="all !s390x"
 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=""
+_depends_py2="python2 py2-numpy python2-tkinter py2-dateutil py2-parsing py2-tz
+	py2-cycler py2-cairo py2-kiwisolver"
+_depends_py3="python3 py3-numpy python3-tkinter py3-dateutil py3-parsing py3-tz
+	py3-cycler py3-cairo py3-kiwisolver"
+makedepends="python3-dev python2-dev gfortran py-numpy-dev freetype-dev
+	libpng-dev tk-dev py-setuptools ${_depends_py2} ${_depends_py3}
+	py2-backports_functools_lru_cache"
+subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3
+	$pkgname-doc"
 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
 }
 
 package() {
-	cd "$builddir"
+	mkdir -p "$pkgdir"
+}
+
+_py2() {
+	replaces="$pkgname"
+	depends="$depends $_depends_py2"
+	_py python2
+}
 
-	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/
+_py3() {
+	depends="$depends $_depends_py3"
+	_py python3
+	# Remove documentation, doc-subpkg will use python2 version
+	rm -rf "$subpkgdir/usr/share"
 }
 
-tests() {
-	pkgdesc="$pkgdesc (tests)"
-	arch="noarch"
-	depends="$depends py-nose"
-	local sitepath="$(python2 -c 'import site; print(site.getsitepackages()[0])')/$_pkgname"
+doc() {
+	mkdir -p "${subpkgdir}/usr"
+	mv "${pkgdir}/../py2-$_pkgname/usr/share" "$subpkgdir/usr/"
+}
+
+_py() {
+	local python="$1"
+	pkgdesc="$pkgdesc (for $python)"
+	cd "$builddir"
 
-	mkdir -p "$subpkgdir"$sitepath
-	mv "$pkgdir"$sitepath/tests "$subpkgdir"$sitepath/
+	$python setup.py install --prefix=/usr --root="$subpkgdir" || return 1
+	install -m755 -d "$subpkgdir"/usr/share/licenses/custom/$subpkgname
+	install -m644 LICENSE/* "$subpkgdir"/usr/share/licenses/custom/$subpkgname/
 }
 
-md5sums="b22dc4962f36aab919a7125b3b35953b  matplotlib-1.5.1.tar.gz"
-sha256sums="64c9f7cce4075d05c2602108ee1795aa6455c2c1d8e4329c95c83465e3806887  matplotlib-1.5.1.tar.gz"
-sha512sums="da99fffcb4fb600ed4386ce89e61725768d4209f3bd4ab174e0d8474c24b2736516a4299ceaa0714b276d7d02c3e33e39a6204e014569ec3f6249085b1ba7a0d  matplotlib-1.5.1.tar.gz"
+sha512sums="58dbeabafa7cd008cf5a585829a5b9f098114a43700dedbd7cc3ed09180ea99a870d06295fe8f1d47f1eb807d264924a4b6fb7cf47e6bc3b74045aa4f0714ac9  matplotlib-2.2.2.tar.gz"
-- 
2.17.0



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Leonardo Arena
Details
Message ID
<CAGG_d8AGf8ZZ-naV8oEM4v6QKNnFVVA-ojPcVMyV+r9V0veRVw@mail.gmail.com>
In-Reply-To
<20180521213329.13734-1-marian.buschsieweke@ovgu.de> (view parent)
Sender timestamp
1539584541
DKIM signature
missing
Download raw message
Hi,

sorry for the late feedback.

Please see some comments below:

On Mon, May 21, 2018 at 11:33 PM Marian Buschsieweke <
marian.buschsieweke@ovgu.de> wrote:

> Added subpackages py2-matplotlib and py3-matplotlib, which provide the
> python2
> and python3 version of matplotlib.
> ---
>  testing/py-matplotlib/APKBUILD | 59 ++++++++++++++++++++++------------
>  1 file changed, 39 insertions(+), 20 deletions(-)
>
> diff --git a/testing/py-matplotlib/APKBUILD
> b/testing/py-matplotlib/APKBUILD
> index 45e057e3f6..d71994b560 100644
> --- a/testing/py-matplotlib/APKBUILD
> +++ b/testing/py-matplotlib/APKBUILD
> @@ -2,42 +2,61 @@
>  # Maintainer: Isaac Dunham <ibid.ag@gmail.com>
>  pkgname=py-matplotlib
>  _pkgname=matplotlib
> -pkgver=1.5.1
> -pkgrel=2
> +pkgver=2.2.2
> +pkgrel=0
>  pkgdesc="A Python library for plots"
>  url="http://matplotlib.org"
>  arch="all !s390x"
>  license="custom"
>


I think the licence needs to be adjusted.



> -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=""
> +_depends_py2="python2 py2-numpy python2-tkinter py2-dateutil py2-parsing
> py2-tz
> +       py2-cycler py2-cairo py2-kiwisolver"
> +_depends_py3="python3 py3-numpy python3-tkinter py3-dateutil py3-parsing
> py3-tz
> +       py3-cycler py3-cairo py3-kiwisolver"
>

We use to specify unversioned dependencies in "depends" and then in the
respective subpackage we do a variable substitution for each python version:

depends="${depends//py-/py2-}"
depends="${depends//py-/py3-}"

+makedepends="python3-dev python2-dev gfortran py-numpy-dev freetype-dev
> +       libpng-dev tk-dev py-setuptools ${_depends_py2} ${_depends_py3}
> +       py2-backports_functools_lru_cache"
> +subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3
> +       $pkgname-doc"
>  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
>  }
>

"|| return 1" can be removed nowdays.



>
>  package() {
> -       cd "$builddir"
> +       mkdir -p "$pkgdir"
> +}
> +
> +_py2() {
> +       replaces="$pkgname"
> +       depends="$depends $_depends_py2"
> +       _py python2
> +}
>
> -       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/
> +_py3() {
> +       depends="$depends $_depends_py3"
> +       _py python3
> +       # Remove documentation, doc-subpkg will use python2 version
> +       rm -rf "$subpkgdir/usr/share"
>  }
>
> -tests() {
> -       pkgdesc="$pkgdesc (tests)"
> -       arch="noarch"
> -       depends="$depends py-nose"
> -       local sitepath="$(python2 -c 'import site;
> print(site.getsitepackages()[0])')/$_pkgname"
> +doc() {
> +       mkdir -p "${subpkgdir}/usr"
> +       mv "${pkgdir}/../py2-$_pkgname/usr/share" "$subpkgdir/usr/"
> +}
> +
> +_py() {
> +       local python="$1"
> +       pkgdesc="$pkgdesc (for $python)"
> +       cd "$builddir"
>
> -       mkdir -p "$subpkgdir"$sitepath
> -       mv "$pkgdir"$sitepath/tests "$subpkgdir"$sitepath/
> +       $python setup.py install --prefix=/usr --root="$subpkgdir" ||
> return 1
> +       install -m755 -d "$subpkgdir"/usr/share/licenses/custom/$subpkgname
> +       install -m644 LICENSE/*
> "$subpkgdir"/usr/share/licenses/custom/$subpkgname/
>  }
>
>
Doesn't look like there are tests enabled nor disabled.

Thanks!

/eo