#Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>

_pkgname=Pylons
pkgname=(python2-${_pkgname,,})
pkgver=1.0.3
pkgrel=1
pkgdesc='A lightweight web framework emphasizing flexibility and rapid development.'
arch=(any)
url='http://pylonsproject.com/'
license=('BSD')

_depends=(routes webhelpers beaker paste paste-deploy paste-script formencode
          simplejson decorator nose mako webob weborror webtest tempita)
makedepends=(python{,2}-setuptools)
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/${_pkgname}/${_pkgname}-${pkgver}.tar.gz")
sha256sums=('49291401cef1bea680499dd5e3b5906cfdfe52d65f6f396f6f6b90842ff70da8')

_package() {
  depends=("$1" "${_depends[@]/#/$1-}")
  cd "$srcdir"/$_pkgname-$pkgver
  $1 setup.py install --root="$pkgdir"

  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
  sed -i -e "s|#![ ]*/usr/bin/python$|#!/usr/bin/python2|" \
         -e "s|#![ ]*/usr/bin/env python$|#!/usr/bin/env python2|" \
    $(find "$pkgdir" -name '*.py')
}

for _pkg in "${pkgname[@]}"; do
  eval "package_$_pkg () { _package ${_pkg%%-*}; }"
done
