# $Id: PKGBUILD 93555 2013-07-05 16:15:01Z jelle $
# Maintainer: Angel Velasquez <angvp@archlinux.org> 
# Contributor: Kaiting Chen <kaitocracy@gmail.com>
# Contributor: Douglas Soares de Andrade <dsa@aur.archlinux.org>
# Contributor: Armando M. Baratti <amblistas@ajato.com.br>
# Contributor: Florian Richter <Florian_Richter@gmx.de>
pkgname=('python-cherrypy' 'python2-cherrypy')
pkgver=3.2.3
pkgrel=1
pkgdesc="A pythonic, object-oriented web development framework"
arch=('any')
url="http://www.cherrypy.org"
license=('BSD')
makedepends=('python' 'python2')
source=("https://bitbucket.org/cherrypy/cherrypy/downloads/CherryPy-${pkgver}.tar.gz")
md5sums=('cf64caa265d08f391da7539196fb36d0')

build() {
  cp -r CherryPy-${pkgver} CherryPy2-${pkgver}

  cd CherryPy-${pkgver}
  python ./setup.py build

  cd "${srcdir}/CherryPy2-${pkgver}"
  sed \
    -e 's_#! /usr/bin/env python_&2_' \
    -i cherrypy/cherryd
  sed \
    -e 's_#!/usr/bin/python_&2_' \
    -i cherrypy/test/sessiondemo.py
  python2 ./setup.py build

}

package_python-cherrypy() {
  depends=('python')

  cd CherryPy-${pkgver}

  python ./setup.py install --root="${pkgdir}" --optimize=1

  install -Dm644 cherrypy/LICENSE.txt \
    "${pkgdir}/usr/share/licenses/python-cherrypy/LICENSE.txt"
}

package_python2-cherrypy() {
  depends=('python2')

  cd CherryPy2-${pkgver}

  python2 ./setup.py install --root="${pkgdir}" --optimize=1
  mv "${pkgdir}/usr/bin/cherryd" "${pkgdir}/usr/bin/cherryd2"

  install -Dm644 cherrypy/LICENSE.txt \
    "${pkgdir}/usr/share/licenses/python2-cherrypy/LICENSE.txt"
}
md5sums=('cf64caa265d08f391da7539196fb36d0')
