summaryrefslogtreecommitdiff
path: root/community/python-matplotlib/PKGBUILD
blob: 7e90764c93e47f0172ea643f8656f2428aadbf68 (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
# $Id: PKGBUILD 80031 2012-11-15 15:02:41Z stephane $
# Maintainer: Stéphane Gaudreault <stephane@archlinux.org>
# Contributor: Stefan Husmann <stefan-husmann@t-online.de>
# Contributor: Angel 'angvp' Velasquez <angvp[at]archlinux.com.ve>
# Contributor: Douglas Soares de Andrade <dsa@aur.archlinux.org>

pkgbase=python-matplotlib
pkgname=('python2-matplotlib' 'python-matplotlib')
pkgver=1.2.0
pkgrel=3
pkgdesc="A python plotting library, making publication quality plots"
arch=('i686' 'x86_64')
url="http://matplotlib.sourceforge.net/"
license=('custom')
makedepends=('python2-pytz' 'python2-numpy' 'python2-pyqt'
             'python-pytz' 'python-numpy' 'pyqt')
source=("https://github.com/downloads/matplotlib/matplotlib/matplotlib-${pkgver}.tar.gz"
         setup.cfg)
sha1sums=('1d0c319b2bc545f1a7002f56768e5730fe573518'
          '370a08120bcb3046f590c527b3d29d18ae874818')

build() {
   cd "${srcdir}"/matplotlib-${pkgver}

   # use system python-six
   rm lib/six.py

   cp ../setup.cfg .

   # For numpy 1.7
   sed -i '/include/s/numpy\/arrayobject.h/numpy\/oldnumeric.h/g' \
      src/*.{c,cpp,h} lib/matplotlib/delaunay/*.{cpp,h} lib/matplotlib/tri/*.h

   cd ..
   cp -a matplotlib-${pkgver} matplotlib-${pkgver}-py3

   # Build python2
   cd matplotlib-${pkgver}
   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

   python2 setup.py build

   # Build python3
   cd ../matplotlib-${pkgver}-py3
   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

   python3 setup.py build
}

package_python2-matplotlib() {
   depends=('python2-pytz' 'python2-numpy' 'python2-pyqt' 'python2-dateutil')

   cd "${srcdir}"/matplotlib-${pkgver}
   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_python-matplotlib() {
   depends=('python-pytz' 'python-numpy' 'pyqt' 'python-dateutil')
   cd "${srcdir}"/matplotlib-${pkgver}-py3
   python3 setup.py install -O1 --skip-build --root "${pkgdir}" --prefix=/usr

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