summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f1359b6d663a994f37641cd40254d17462203c9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# $Id$
# Maintainer: Dylan Delgado <dylan1496@live.com>
# Contributor: Grey Christoforo <first name [at] last name [dot] net>

pkgname=python-matplotlib-git

pkgver=r49602.5e34777719
pkgrel=1
pkgdesc="A python plotting library for making publication quality plots, master git branch"
arch=('i686' 'x86_64')
url='http://matplotlib.org'
license=('custom')
checkdepends=('python-mock' 'xorg-server-xvfb'
              'texlive-core' 'texlive-latexextra' 'imagemagick' 'ffmpeg' 'mencoder' 'inkscape'
              'python-pycodestyle' 'python-pandas' )
makedepends=('rsync' 'git' 'python-pytz' 'python-numpy'
             'tk' 'python-cairocffi' 'python-dateutil'
             'python-gobject' 'python-pyparsing'
             'pygtk' 'python-six' 'ghostscript' 'texlive-bin'
             'python-tornado' 'gtk3' 'python-wxpython' 'python-pyqt5' 
             'libxkbcommon-x11' 'python-pillow'  'python-setuptools'
             'python-cycler' "pybind11" 'python-build' 'python-installer' 'python-wheel' 'meson-python')
source=("git+https://github.com/matplotlib/matplotlib.git#branch=main" setup.cfg)
md5sums=('SKIP'
         '5fa7d3c374ec049e3ed592ddff0111be')

pkgver() {
   cd "${srcdir}/matplotlib"
   printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
   cd "$srcdir"/matplotlib
   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 python|" ${file}
   done

   rsync -a "$srcdir"/matplotlib/  "$srcdir"/matplotlib-test --exclude '.git'

   # Remove tests (FS#48175)
   cp "$srcdir/setup.cfg" "$srcdir"/matplotlib/
}

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
   python -m build --wheel --no-isolation
}

check() {
   cd "$srcdir"/matplotlib

   pytest
}

package() {
   depends=('python-kiwisolver' 'python-pytz' 'python-numpy' 'python-pyqt5' 'python-dateutil' 'python-pyparsing' 'python-cycler' 'libxkbcommon-x11')
   optdepends=('python-gobject: for GTK3Agg/GTK3Cairo backend'
               'python-cairocffi: for GTK3Agg/GTK3Cairo backend'
               'tk: used by the TkAgg backend'
               'ghostscript: usetex dependencies'
               'texlive-bin: usetex dependencies'
               'python-tornado: for webagg backend'
               'python-pillow: for reading/saving .jpg/bmp/tiff files')
   provides=('python-matplotlib')
   conflicts=('python-matplotlib' 'python-matplotlib2')

   cd matplotlib
   python -m installer --destdir="$pkgdir" dist/*.whl

   install -dm755 "${pkgdir}"/usr/share/licenses/python-matplotlib
   install -m 644 doc/project/license.rst "${pkgdir}"/usr/share/licenses/python-matplotlib
}