# Contributor: Francesco Colista <francesco.colista@gmail.com>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py-cherrypy
_pkgname=CherryPy
pkgver=8.1.2
pkgrel=1
pkgdesc="A pythonic, object-oriented web development framework"
url="http://www.cherrypy.org"
arch="noarch"
license="BSD"
depends="py-six"
makedepends="python2-dev python3-dev py-setuptools"
subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

build() {
	cd "$builddir"
	python2 setup.py build || return 1
	python3 setup.py build || return 1
}

package() {
	mkdir -p "$pkgdir"
}

_py2() {
	replaces="$pkgname"
	depends="${depends//py-/py2-}"
	_py python2
}

_py3() {
	depends="${depends//py-/py3-}"
	_py python3
}

_py() {
	local python="$1"
	pkgdesc="$pkgdesc (for $python)"
	depends="$depends $python"
	install_if="$pkgname=$pkgver-r$pkgrel $python"

	cd "$builddir"
	$python setup.py install --prefix=/usr --root="$subpkgdir"
}

md5sums="553f054152c2adbe60738682ed5390c5  CherryPy-8.1.2.tar.gz"
sha256sums="45a92fdd18baa19d055e5f53bb3c4293821a30e83bf3c5244b867685397f5380  CherryPy-8.1.2.tar.gz"
sha512sums="63c267969df2d24e46f63685773b2af55595f8a162f8abd91e4b2877fedc4b42ec67c8a2c79d4c0f999cbaa1fd3fff7df103914af6f105e08f6e1d256dd390f5  CherryPy-8.1.2.tar.gz"
