# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py-msgpack
_pkgname=msgpack-python
pkgver=0.4.8
pkgrel=2
pkgdesc="A Python module for MessagePack serialization/deserialization"
url="http://pypi.python.org/pypi/msgpack-python/"
arch="all"
license="ASL 2.0"
depends=""
makedepends="python2-dev python3-dev py-setuptools"
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"

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

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

_py() {
	local python=$1
	pkgdesc="$pkgdesc (for $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
}

md5sums="dcd854fb41ee7584ebbf35e049e6be98  msgpack-python-0.4.8.tar.gz"
sha256sums="1a2b19df0f03519ec7f19f826afb935b202d8979b0856c6fb3dc28955799f886  msgpack-python-0.4.8.tar.gz"
sha512sums="59e9c43be6b92e6d10f40999e0902c350137e67a83c43bb15b273eca856a6eb39f24b625b02b40188a9365ce3101f03bfa9aa3dfff56c5c3b551533942183481  msgpack-python-0.4.8.tar.gz"