pkgbase=python-matplotlib pkgname=('python2-matplotlib' 'python3-matplotlib') pkgver=1.5.1 pkgrel=1 pkgdesc="A python plotting library, making publication quality plots" arch=('x86_64') url='http://matplotlib.org' license=('custom') makedepends=('python2-pytz' 'python2-numpy' 'python2-pyqt4' 'python3-pytz' 'python3-numpy' 'python3-pyqt4' 'tk' 'python3-cairo' 'python2-cairo' 'python3-dateutil' 'python2-dateutil' 'python3-gobject' 'python2-gobject' 'python3-pyparsing' 'python2-pyparsing' 'python3-six' 'ghostscript' 'texlive-bin' 'python3-tornado' 'python2-tornado' 'python3-pyqt5' 'python2-pyqt5' 'libxkbcommon-x11' 'python3-pillow' 'python2-pillow' 'python3-setuptools' 'python2-setuptools' 'python3-cycler' 'python2-cycler') source=("$pkgbase-$pkgver.tar.gz::https://github.com/matplotlib/matplotlib/archive/v$pkgver.tar.gz" setup.cfg) sha512sums=('da99fffcb4fb600ed4386ce89e61725768d4209f3bd4ab174e0d8474c24b2736516a4299ceaa0714b276d7d02c3e33e39a6204e014569ec3f6249085b1ba7a0d' '0f594854acc9dfda700b4c9bf9a5fa284897b5f612f8dd1da274e682b4bb59392034e058ed661a4f973e43577199c7412cee07774faee19d87e57fd6161574f4') prepare() { cp -a "$srcdir"/matplotlib-${pkgver}{,-py2} cd "$srcdir"/matplotlib-${pkgver} for file in $(find . -name '*.py' -print); do sed -i -e "s|^#!.*/usr/bin/python|#!/usr/bin/python3|" \ -e "s|^#!.*/usr/bin/env *python|#!/usr/bin/env python3|" ${file} done cd "$srcdir"/matplotlib-${pkgver}-py2 for file in $(find . -name '*.py' -print); do sed -i -e "s|^#!.*/usr/bin/python|#!/usr/bin/python2|" \ -e "s|^#!.*/usr/bin/env *python|#!/usr/bin/env python2|" ${file} done cp -a "$srcdir"/matplotlib-${pkgver}{,-test} cp -a "$srcdir"/matplotlib-${pkgver}-py2{,-test} # Remove tests (FS#48175) cp "$srcdir/setup.cfg" "$srcdir"/matplotlib-$pkgver/ cp "$srcdir/setup.cfg" "$srcdir"/matplotlib-$pkgver-py2/ } build() { # this seems to need to be present or gtk/gdk dies # and hangs the build checking if gtk3cairo is installed export XDG_RUNTIME_DIR=/tmp cd "$srcdir"/matplotlib-${pkgver} python3 setup.py build cd "$srcdir"/matplotlib-${pkgver}-py2 python2 setup.py build } package_python2-matplotlib() { depends=('python2-pytz' 'python2-numpy' 'python2-pyqt5' 'python2-dateutil' 'python2-pyparsing' 'python2-cycler' 'libxkbcommon-x11') optdepends=('pygtk: for GTK/GTKAgg/GTKCairo backend' 'python2-cairo: for GTKCairo/GTK3Cairo backend' 'python2-cairocffi: for GTKCairo/GTK3Cairo backend (alternative to python2-cairo)' 'python2-pyqt4: for Qt4Agg backend' 'tk: used by the TkAgg backend' 'ghostscript: usetex dependencies' 'texlive-bin: usetex dependencies' 'python2-tornado: for webagg backend' 'python2-gobject: for GTK3Agg/GTK3Cairo backend' 'wxpython: for WX/WXAgg backend' 'python2-pillow: for reading/saving .jpg/bmp/tiff files') cd matplotlib-${pkgver}-py2 python2 setup.py install -O1 --skip-build --root "${pkgdir}" --prefix=/usr install -dm755 "${pkgdir}"/usr/share/licenses/python2-matplotlib install -m 644 doc/users/license.rst "${pkgdir}"/usr/share/licenses/python2-matplotlib } package_python3-matplotlib() { depends=('python3-pytz' 'python3-numpy' 'python3-pyqt5' 'python3-dateutil' 'python3-pyparsing' 'python3-cycler' 'libxkbcommon-x11') optdepends=('python3-gobject: for GTK3Agg/GTK3Cairo backend' 'python3-cairocffi: for GTK3Agg/GTK3Cairo backend' 'python3-pyqt4: for Qt4Agg backend' 'tk: used by the TkAgg backend' 'ghostscript: usetex dependencies' 'texlive-bin: usetex dependencies' 'python3-tornado: for webagg backend' 'python3-pillow: for reading/saving .jpg/bmp/tiff files') cd matplotlib-${pkgver} python3 setup.py install -O1 --skip-build --root "${pkgdir}" --prefix=/usr install -dm755 "${pkgdir}"/usr/share/licenses/python3-matplotlib install -m 644 doc/users/license.rst "${pkgdir}"/usr/share/licenses/python3-matplotlib }