# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=py-decorator
_pkgname=decorator
pkgver=4.1.2
pkgrel=0
pkgdesc="Python Decorator module"
url="https://pypi.python.org/pypi/decorator"
arch="noarch"
license="BSD"
depends=""
makedepends="python2-dev py-setuptools python3-dev"
subpackages="py3-${pkgname#py-}:_py3 py2-${pkgname#py-}:_py2"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

check() {
    cd "$builddir"
    python2 setup.py check
    python3 setup.py check
}


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

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

_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"
}

_py2() {
	replaces="$pkgname"
	_py python2
}

_py3() {
	_py python3
}

sha512sums="4a4b9dc39de9b3f00eae9b6829136f5d836355d3d719371440f69c33fdddf73636e9faaa8fc35829c64d5c5a61d968ea427267da944c524c22ad08b69fb6f0ff  decorator-4.1.2.tar.gz"
