void-packages/srcpkgs/python-matplotlib/template

243 lines
8.9 KiB
Bash

# Template file for 'python-matplotlib'
pkgname=python-matplotlib
version=1.4.3
revision=1
wrksrc="matplotlib-${version}"
build_style=python-module
python_versions="2.7 3.4"
hostmakedepends="pkg-config python-setuptools python3.4-setuptools"
# XXX: use internal copy of agg and pycxx, highly patched
makedepends="
python-devel python3.4-devel python-numpy-devel python3.4-numpy-devel
python-six python3.4-six python-dateutil python3.4-dateutil python-pytz
python3.4-pytz python-tornado python3.4-tornado python-parsing
python3.4-parsing python-PyQt4-devel python-PyQt5-devel python-cairocffi
python3.4-cairocffi python-gobject-devel pygtk-devel gtk+3-devel tk-devel
python-tkinter python3.4-tkinter wxPython-devel freetype-devel libpng-devel
libqhull-devel"
depends="python-matplotlib-data>=${version}_${revision} python-numpy python-six
python-dateutil python-parsing python-pytz"
pycompile_module="matplotlib mpl_toolkits pylab.py"
short_desc="Python2 2D/3D plotting library"
_short_desc="${short_desc/Python2/Python3.4}"
maintainer="Alessio Sergi <al3hex@gmail.com>"
homepage="http://matplotlib.org/"
license="matplotlib, BSD, MIT"
distfiles="${PYPI_SITE}/m/matplotlib/matplotlib-${version}.tar.gz"
checksum=61f201c6a82e89e4d9e324266203fad44f95fd8f36d8eec0d8690273e1182f75
nocross=yes
export XDG_RUNTIME_DIR=/tmp
_pysitedir="usr/lib/python2.7/site-packages"
_py34sitedir="usr/lib/python3.4/site-packages"
pre_build() {
# set Agg as default backend
cat > setup.cfg <<-EOF
[rc_options]
backend = Agg
EOF
# remove shebangs
find . -type f -name '*.py' -exec sed -i "s,^#!.*python$,," {} +
# adjust path
sed -i 's,\(site-packages/matplotlib/mpl-data\),/etc,' matplotlibrc.template
}
post_install() {
# remove gtk and wx backends, not compatible with python3
rm -f ${DESTDIR}/${_py34sitedir}/matplotlib/backends/backend_{gdk,gtk,gtkagg,gtkcairo,wx,wxagg}.py
# do not install baseline_images, needed for tests only, but huge
rm -rf ${DESTDIR}/usr/lib/python*/site-packages/{matplotlib,mpl_toolkits}/tests/baseline_images
# remove data files
rm -rf ${DESTDIR}/usr/lib/python*/site-packages/matplotlib/{mpl-data,backends/Matplotlib.nib}
}
python-matplotlib-data_package() {
noarch=yes
conf_files="/etc/matplotlibrc"
short_desc+=" - data files"
pkg_install() {
vmkdir usr/share/matplotlib
vcopy ${wrksrc}/lib/matplotlib/mpl-data usr/share/matplotlib
vcopy ${wrksrc}/lib/matplotlib/backends/Matplotlib.nib usr/share/matplotlib
vsconf ${wrksrc}/matplotlibrc.template
vconf ${PKGDESTDIR}/usr/share/matplotlib/mpl-data/matplotlibrc
rm -f ${PKGDESTDIR}/usr/share/matplotlib/mpl-data/matplotlibrc
}
}
python-matplotlib-cairo_package() {
depends="${sourcepkg}>=${version}_${revision} python-cairocffi"
short_desc+=" - cairo backend"
pycompile_module="matplotlib"
pkg_install() {
vmove ${_pysitedir}/matplotlib/backends/backend_cairo.py
}
}
python-matplotlib-gtk_package() {
depends="${sourcepkg}-cairo>=${version}_${revision} pygtk"
short_desc+=" - GTK+ backend"
pycompile_module="matplotlib"
pkg_install() {
vmove ${_pysitedir}/matplotlib/backends/_backend_gdk.so
vmove ${_pysitedir}/matplotlib/backends/_gtkagg.so
vmove ${_pysitedir}/matplotlib/backends/backend_gdk.py
vmove ${_pysitedir}/matplotlib/backends/backend_gtk.py
vmove ${_pysitedir}/matplotlib/backends/backend_gtkagg.py
vmove ${_pysitedir}/matplotlib/backends/backend_gtkcairo.py
}
}
python-matplotlib-gtk3_package() {
depends="${sourcepkg}-cairo>=${version}_${revision}
gtk+3 gir-freedesktop python-gobject"
short_desc+=" - GTK+3 backend"
pycompile_module="matplotlib"
pkg_install() {
vmove ${_pysitedir}/matplotlib/backends/backend_gtk3.py
vmove ${_pysitedir}/matplotlib/backends/backend_gtk3agg.py
vmove ${_pysitedir}/matplotlib/backends/backend_gtk3cairo.py
}
}
# XXX: the Qt4 backend makes use of the Qt5 backend, which is actually a
# generic Qt backend. So we need to package all the Qt5 stuff in this generic
# package and provide a stub package which pulls in the python-PyQt5 dependency.
python-matplotlib-qtshared_package() {
depends="${sourcepkg}>=${version}_${revision}"
short_desc+=" - shared files for the Qt backends"
pycompile_module="matplotlib"
pkg_install() {
vmove ${_pysitedir}/matplotlib/backends/backend_qt5.py
vmove ${_pysitedir}/matplotlib/backends/backend_qt5agg.py
vmove ${_pysitedir}/matplotlib/backends/qt_compat.py
vmove ${_pysitedir}/matplotlib/backends/qt4_compat.py
vmove ${_pysitedir}/matplotlib/backends/qt_editor
}
}
python-matplotlib-qt4_package() {
depends="${sourcepkg}-qtshared>=${version}_${revision} python-PyQt4"
short_desc+=" - Qt4 backend"
pycompile_module="matplotlib"
pkg_install() {
vmove ${_pysitedir}/matplotlib/backends/backend_qt4.py
vmove ${_pysitedir}/matplotlib/backends/backend_qt4agg.py
}
}
python-matplotlib-qt5_package() {
depends="${sourcepkg}-qtshared>=${version}_${revision} python-PyQt5"
short_desc+=" - Qt5 backend"
pkg_install() {
:
}
}
python-matplotlib-tk_package() {
depends="${sourcepkg}>=${version}_${revision} python-tkinter"
short_desc+=" - Tk backend"
pycompile_module="matplotlib"
pkg_install() {
vmove ${_pysitedir}/matplotlib/backends/_tkagg.so
vmove ${_pysitedir}/matplotlib/backends/backend_tkagg.py
vmove ${_pysitedir}/matplotlib/backends/tkagg.py
}
}
python-matplotlib-web_package() {
depends="${sourcepkg}>=${version}_${revision} python-tornado"
short_desc+=" - web backend"
pkg_install() {
vmove ${_pysitedir}/matplotlib/backends/backend_webagg.py
vmove ${_pysitedir}/matplotlib/backends/backend_webagg_core.py
vmove ${_pysitedir}/matplotlib/backends/web_backend
}
}
python-matplotlib-wx_package() {
depends="${sourcepkg}>=${version}_${revision} wxPython"
short_desc+=" - wx backend"
pkg_install() {
vmove ${_pysitedir}/matplotlib/backends/backend_wx.py
vmove ${_pysitedir}/matplotlib/backends/backend_wxagg.py
}
}
python3.4-matplotlib_package() {
depends="python-matplotlib-data>=${version}_${revision} python3.4-numpy
python3.4-six python3.4-dateutil python3.4-parsing python3.4-pytz"
short_desc="${_short_desc}"
pycompile_version="3.4"
pycompile_module="matplotlib mpl_toolkits pylab.py"
pkg_install() {
vmove usr/lib/python3.4
}
}
python3.4-matplotlib-cairo_package() {
depends="python3.4-matplotlib>=${version}_${revision} python3.4-cairocffi"
short_desc="${_short_desc} - cairo backend"
pycompile_version="3.4"
pycompile_module="matplotlib"
pkg_install() {
vmove ${_py34sitedir}/matplotlib/backends/backend_cairo.py
}
}
python3.4-matplotlib-gtk3_package() {
depends="python3.4-matplotlib-cairo>=${version}_${revision}
gtk+3 gir-freedesktop python3.4-gobject"
short_desc="${_short_desc} - GTK+3 backend"
pycompile_version="3.4"
pycompile_module="matplotlib"
pkg_install() {
vmove ${_py34sitedir}/matplotlib/backends/backend_gtk3.py
vmove ${_py34sitedir}/matplotlib/backends/backend_gtk3agg.py
vmove ${_py34sitedir}/matplotlib/backends/backend_gtk3cairo.py
}
}
# XXX: the Qt4 backend makes use of the Qt5 backend, which is actually a
# generic Qt backend. So we need to package all the Qt5 stuff in this generic
# package and provide a stub package which pulls in the python3.x-PyQt5 dependency.
python3.4-matplotlib-qtshared_package() {
depends="python3.4-matplotlib>=${version}_${revision}"
short_desc="${_short_desc} - shared files for the Qt backends"
pycompile_version="3.4"
pycompile_module="matplotlib"
pkg_install() {
vmove ${_py34sitedir}/matplotlib/backends/backend_qt5.py
vmove ${_py34sitedir}/matplotlib/backends/backend_qt5agg.py
vmove ${_py34sitedir}/matplotlib/backends/qt_compat.py
vmove ${_py34sitedir}/matplotlib/backends/qt4_compat.py
vmove ${_py34sitedir}/matplotlib/backends/qt_editor
}
}
python3.4-matplotlib-qt4_package() {
depends="python3.4-matplotlib-qtshared>=${version}_${revision} python3.4-PyQt4"
short_desc="${_short_desc} - Qt4 backend"
pycompile_version="3.4"
pycompile_module="matplotlib"
pkg_install() {
vmove ${_py34sitedir}/matplotlib/backends/backend_qt4.py
vmove ${_py34sitedir}/matplotlib/backends/backend_qt4agg.py
}
}
python3.4-matplotlib-qt5_package() {
depends="python3.4-matplotlib-qtshared>=${version}_${revision} python3.4-PyQt5"
short_desc="${_short_desc} - Qt5 backend"
pkg_install() {
:
}
}
python3.4-matplotlib-tk_package() {
depends="python3.4-matplotlib>=${version}_${revision} python3.4-tkinter"
short_desc="${_short_desc} - Tk backend"
pycompile_version="3.4"
pycompile_module="matplotlib"
pkg_install() {
vmove ${_py34sitedir}/matplotlib/backends/_tkagg.cpython-34m.so
vmove ${_py34sitedir}/matplotlib/backends/backend_tkagg.py
vmove ${_py34sitedir}/matplotlib/backends/tkagg.py
}
}
python3.4-matplotlib-web_package() {
depends="python3.4-matplotlib>=${version}_${revision} python3.4-tornado"
short_desc="${_short_desc} - web backend"
pycompile_version="3.4"
pycompile_module="matplotlib"
pkg_install() {
vmove ${_py34sitedir}/matplotlib/backends/backend_webagg.py
vmove ${_py34sitedir}/matplotlib/backends/backend_webagg_core.py
vmove ${_py34sitedir}/matplotlib/backends/web_backend
}
}