# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py-transitions
_pkgname=transitions
pkgver=0.4.2
pkgrel=1
pkgdesc="A lightweight, object-oriented Python state machine implementation"
url="https://github.com/tyarkoni/transitions"
arch="noarch"
license="MIT"
depends="py-six"
makedepends="python2-dev py-setuptools python3-dev"
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="47c77f7ee61a997e297251a55e4e3019  transitions-0.4.2.tar.gz"
sha256sums="94752bed6d33351bf8bd07a944b27b446a1ecda48bdba16a57505a8beb3fac61  transitions-0.4.2.tar.gz"
sha512sums="8dc876ad12b8cc9813eb81a33a9b1e2cee669cdc2acf7dc18169b5aee3a91b2f55997054f35f0cb50261e66c43fc5d6bddc8d9f35125d2a690fcd0f2469d5802  transitions-0.4.2.tar.gz"
