# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=py-raven
_pkgname=raven-python
pkgver=6.6.0
pkgrel=1
pkgdesc="Python client for Sentry"
url="https://github.com/getsentry/raven-python"
arch="noarch"
license="BSD-3-Clause"
depends=""
makedepends="py-setuptools python2-dev python3-dev py2-pytest py3-pytest"
subpackages="py3-${pkgname/py-/}:_py3 py2-${pkgname/py-/}:_py2"
source="$pkgname-$pkgver.tar.gz::https://github.com/getsentry/$_pkgname/archive/$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

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

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

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

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

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

sha512sums="19d5db95669b44748d6a7f0478993e0119b23d11de80d6c25e77a6044b655bca8bb18fc48e20fbc93f592f6d9111e7666857509b42f48cbea2006a491e2ad1cd  py-raven-6.6.0.tar.gz"
