# Maintainer: Lukas Fleischer <lfleischer at archlinux dot org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Jaroslav Lichtblau <dragonlord@aur.archlinux.org>
# Contributor: Hugo Doria <hugodoria at gmail.com>

pkgname=translate-toolkit
pkgver=1.13.0
pkgrel=1
pkgdesc="A toolkit to convert between various different translation formats, help process and validate localisations"
arch=('any')
url="http://translate.sourceforge.net/wiki/toolkit/index"
license=('GPL')
depends=('bash' 'python2-lxml' 'python2-six')
makedepends=('python2-setuptools')
optdepends=('python2-iniparse: to use ini2po script')
source=("https://github.com/translate/translate/releases/download/$pkgver/${pkgname}-${pkgver}.tar.bz2")
md5sums=('f9997a0deb3f1767bb20665a47cd2708')

package() {
  cd ${pkgname}-${pkgver}

  sed -i -e "s|#![ ]*/usr/bin/python$|#!/usr/bin/python2|" \
    -e "s|#![ ]*/usr/bin/env python$|#!/usr/bin/env python2|" \
    -e "s|/usr/bin/python2.4|/usr/bin/python2|" \
    $(find . -name '*.py')

  python2 -s setup.py install --root="${pkgdir}" --optimize=1
  python2 -m compileall "${pkgdir}"/usr/lib/python2.7/site-packages/translate
}
