# $Id: PKGBUILD 163086 2012-07-06 18:07:49Z schiv $
# Maintainer: Ray Rashif <schiv@archlinux.org>
# Contributor: Brad Fanella <bradfanella@archlinux.us>
# See .contrib for older/other contributors

pkgname=eric
pkgver=5.2.3
pkgrel=1
pkgdesc="A full-featured Python 3.x and Ruby IDE in PyQt4"
arch=('any')
url="http://eric-ide.python-projects.org/"
license=('GPL3')
depends=('python-qscintilla')
conflicts=('eric5')
provides=('eric5')
replaces=('eric5')
install=$pkgname.install
source=("http://downloads.sourceforge.net/eric-ide/eric5-$pkgver.tar.gz"
        "$pkgname.desktop")
md5sums=('9ee14046ff8b5368e5424ca7b376dc9a'
         '8aa446c29e6de54e85410e040e754c6e')

build() {
  cd "$srcdir/eric5-$pkgver"

  # some freedesktop.org compatibility adjustments
  for i in $(grep -R "eric5.desktop" . | sed 's/:.*//' | sort -u); do
    sed -i "s/eric5.desktop/eric.desktop/" $i
  done

  rm eric/eric5.desktop
  install -m644 ../$pkgname.desktop eric/$pkgname.desktop
}

package() {
  cd "$srcdir/eric5-$pkgver"

  python install.py -c -b /usr/bin -i "$pkgdir"

  # Remove files conflicting with eric4
  # what are we doing here?
  # TODO: tell upstream to fix their stuff
  #   and allow installation of eric4 + eric5
  #   OR package these files separately eg. 'eric-common'
  rm "$pkgdir/usr/share/qt/qsci/api/python/zope-2.10.7.api"
  rm "$pkgdir/usr/share/qt/qsci/api/python/zope-2.11.2.api"
  rm "$pkgdir/usr/share/qt/qsci/api/python/zope-3.3.1.api"
  rm "$pkgdir/usr/share/qt/qsci/api/ruby/Ruby-1.8.7.api"

  # some canonical symlinks
  cd "$pkgdir/usr/bin"
  for i in *; do
    ln -s /usr/bin/$i ${i/eric5/eric}
  done
}

# vim:set ts=2 sw=2 et:
