# $Id: PKGBUILD 112203 2014-05-29 20:08:46Z arodseth $
# Maintainer: Alexander Rødseth <rodseth@gmail.com>
# Contributor: Thomas Dziedzic < gostrc at gmail >
# Contributor: Chris Baker <baker.chris.3@gmail.com>

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

# NOTE: Using an alpha version because it's the first version (apart fomr 3.0a3)
# to support both python 2 and 3. It makes it better suited for a split package.
# Rumors has it that 3.0 is going to be released in about a month.
pkgver=3.0a4

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=('7fe72c386c2d3d050e3f5ffc80741906dbae9767a21558fd85e4208330dfb03e')

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:
