# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer:
pkgname=py-semanticversion
_pkgname=${pkgname#py-}
pkgver=2.6.0
pkgrel=0
pkgdesc="A library implementing the 'SemVer' scheme."
url="https://github.com/rbarrois/python-semanticversion"
arch="all"
license="BSD"
depends=""
makedepends="python2-dev python3-dev py-setuptools py-sphinx"
install=""
subpackages="py3-$_pkgname:_py3 py2-$_pkgname:_py2 $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/rbarrois/python-semanticversion/archive/v$pkgver.tar.gz"
builddir="$srcdir/python-semanticversion-$pkgver"

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

package() {
	cd "$builddir"/docs
	make text || return 1

	mkdir -p "$pkgdir"/usr/share/doc/$pkgname/
	install -m644 _build/text/* \
		"$pkgdir"/usr/share/doc/$pkgname/ || return 1
}

_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" --optimize=1 || return 1
}

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

_py3() {
	_py python3
}

md5sums="49c4d78fec2ab2dabdf6ef5d9a8ea578  py-semanticversion-2.6.0.tar.gz"
sha256sums="110d9c75dc9670a188ab820503c6b40ea4ab3f1450a0aee5a90a24fd60aef358  py-semanticversion-2.6.0.tar.gz"
sha512sums="18db9279c2728565b13362c54bedbf569f0878cbe6bb58e631d87ffe7cff7d9131a30a2592cbf511091c03e854851159bbb298fe7469f53e8a2d92cf26ab4d0b  py-semanticversion-2.6.0.tar.gz"
