desktop/python-matplotlib/PKGBUILD
2017-10-28 20:02:10 +02:00

94 lines
4.1 KiB
Bash

pkgbase=python-matplotlib
pkgname=('python2-matplotlib' 'python3-matplotlib')
pkgver=2.1.0
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-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=('19fa97eeb483218f92d72900654984387e90b9f9cc8fd62209443a6eaeb1415e68d7d9c20c5ae0028f99836db58f12aff3af56e756a4673f5130e3f5a724ca87'
'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
}