# Maintainer:
pkgname=py-cliapp
_pkgname=${pkgname#py-}
pkgver=1.20170823
pkgrel=0
pkgdesc="Framework for Unix-like command line programs"
url="http://liw.fi/cliapp"
arch="noarch"
license="GPL-2.0-or-later"
depends="python2 python3"
makedepends="py-setuptools py-yaml"
subpackages="$pkgname-doc py2-$_pkgname:_py2 py3-$_pkgname:_py3"
source="http://code.liw.fi/debian/pool/main/p/python-${_pkgname}/python-${_pkgname}_$pkgver.orig.tar.xz"
builddir="$srcdir/python-$_pkgname-$pkgver"

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

package() {
	mkdir -p "$pkgdir" \
		"$startdir/pkg/$pkgname-doc/usr"
}

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

_py3() {
	_py python3
	mv "$subpkgdir"/usr/share "$startdir/pkg/$pkgname-doc/usr"
}

_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="2b42cd981633791c98c33c968169c4d8bdf0448cc73872d4173e756b7aa390eee46c04c55e87675d27b4aae9e77613cbc574ecb2c0924c549a977aed60ff1924  python-cliapp_1.20170823.orig.tar.xz"
