# $Id: PKGBUILD 108946 2014-04-07 21:42:29Z arodseth $
# Maintainer: Alexander Rødseth <rodseth@gmail.com>
# Contributor: Thomas Dziedzic < gostrc at gmail >
# Contributor: Chris Baker <baker.chris.3@gmail.com>

pkgbase=python2-nltk
pkgname=('python2-nltk' 'python-nltk')

# NOTE: Using an alpha version because it's the first version to support
# both python 2 and 3. It makes it better suited for a split package.
pkgver=3.0a3

pkgrel=1
pkgdesc='Natural language processing in Python'
arch=('any')
url='http://www.nltk.org/'
license=('APACHE')
makedepends=('python-setuptools' 'python2-setuptools')
source=("http://www.nltk.org/nltk3-alpha/nltk-$pkgver.tar.gz")
sha256sums=('52621b3bf944dcae8cbd352ef2664edc95edfeaee321f3f021cfa55ce23eb117')

prepare() {
  cp -r "nltk-$pkgver" "nltk-py2-$pkgver"

  # python 2 fix
  cd "nltk-py2-$pkgver"
  find . -type f -exec sed -i 's:^#.*env python:#!/usr/bin/env python2:' {} +
}

build() {
  cd "$srcdir/nltk-$pkgver"
  python setup.py build

  cd "$srcdir/nltk-py2-$pkgver"
  python2 setup.py build
}

package_python-nltk() {
  optdepends=('nltk-data: test data'
              'python-numpy: used for calculations'
              'python-matplotlib: used for plotting')
  depends=('python-yaml')

  cd "nltk-$pkgver"
  python setup.py install --root="$pkgdir" --optimize=1
}

package_python2-nltk() {
  optdepends=('nltk-data: test data'
              'python2-numpy: used for calculations'
              'python2-matplotlib: used for plotting')
  depends=('python2-yaml')

  cd "nltk-py2-$pkgver"
  python2 setup.py install --root="$pkgdir" --optimize=1
}

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