# Contributor: Stuart Cardall <developer@it-offshore.co.uk>
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
pkgname=py-nosexcover
_pkgname=nose-xcover
pkgver=1.0.11
pkgrel=0
pkgdesc="Extends nose.plugins.cover to add Cobertura-style XML reports"
url="https://pypi.python.org/pypi/nosexcover/"
arch="noarch"
license="MIT"
depends="py-nose py-coverage"
checkdepends="py-nose"
makedepends="python2-dev python3-dev py-setuptools"
subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3"
source="$pkgname-$pkgver.tar.gz::https://github.com/cmheisel/$_pkgname/archive/v$pkgver.tar.gz"
builddir="$srcdir/"$_pkgname-$pkgver

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

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

check() {
	cd "$builddir"
	nosetests -v nosexcover/tests.py
}
sha512sums="e606e89b75d51c728d1487200f4a38afe1af93defabe6bd847b80d597374e7bb10abc2e5c8e6778bbd4f17ba8b8d7a601864a8277cd14437ee94a9e04996cf22  py-nosexcover-1.0.11.tar.gz"
