void-packages/srcpkgs/python-matplotlib/template

77 lines
3.0 KiB
Bash

# Template file for 'python-matplotlib'
pkgname=python-matplotlib
version=1.4.3
revision=3
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 python3.4-numpy
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-pyside
python3.4-pyside 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"
replaces="python-matplotlib-cairo>=0 python-matplotlib-gtk>=0 python-matplotlib-gtk3>=0
python-matplotlib-qtshared>=0 python-matplotlib-qt4>=0 python-matplotlib-qt5>=0
python-matplotlib-tk>=0 python-matplotlib-web>=0 python-matplotlib-wx>=0"
pycompile_module="matplotlib mpl_toolkits pylab.py"
short_desc="Python2 2D/3D plotting library"
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
export XDG_RUNTIME_DIR=/tmp
pre_build() {
# set TkAgg as default backend
cat > setup.cfg <<-EOF
[packages]
tests = False
[rc_options]
backend = TkAgg
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 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
}
}
python3.4-matplotlib_package() {
replaces="python3.4-matplotlib-cairo>=0 python3.4-matplotlib-gtk3>=0
python3.4-matplotlib-qtshared>=0 python3.4-matplotlib-qt4>=0
python3.4-matplotlib-qt5>=0 python3.4-matplotlib-tk>=0 python3.4-matplotlib-web>=0"
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/Python2/Python3.4}"
pycompile_version="3.4"
pycompile_module="matplotlib mpl_toolkits pylab.py"
pkg_install() {
vmove usr/lib/python3.4
}
}