# Contributor: André Klitzing <aklitzing@gmail.com>
# Maintainer: André Klitzing <aklitzing@gmail.com>
pkgname=py-sortedcontainers
_pkgname=sortedcontainers
pkgver=1.5.7
pkgrel=0
pkgdesc="Python Sorted Container Types: SortedList, SortedDict, and SortedSet"
url="http://www.grantjenks.com/docs/sortedcontainers/"
arch="noarch"
license="Apache"
makedepends="python2-dev py-setuptools python3-dev"
subpackages="py3-${pkgname#py-}:_py3 py2-${pkgname#py-}:_py2"
options="!check"
source="$_pkgname-$pkgver.tar.gz::https://github.com/grantjenks/sorted_containers/archive/v$pkgver.tar.gz"
builddir="$srcdir/sorted_containers-$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)"
	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="9b6aef9c95c5543e06e7ee8bd89f86de7ce8f5b518663256113fdbbbd5a9f800c2e9f0ad993acc497f78ae665dd8473369912b3780df565403aee1c519b72814  sortedcontainers-1.5.7.tar.gz"
