# Contributor: Matt Dainty <matt+alpine@bodgit-n-scarper.com>
# Maintainer: TBK <alpine@jjtc.eu>
pkgname=py-jsonpatch
_pkgname=${pkgname#py-}
pkgver=1.16
pkgrel=0
pkgdesc="Apply JSON-Patches (RFC 6902)"
url="https://github.com/stefankoegl/python-json-patch"
arch="noarch"
license="BSD"
depends="py-jsonpointer"
makedepends="python2-dev python3-dev py-setuptools"
subpackages="py3-$_pkgname:_py3 py2-$_pkgname:_py2"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

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

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

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

_py2() {
	replaces="$pkgname"
	depends="${depends//py-/py2-}"
	_py python2
}

_py3() {
	depends="${depends//py-/py3-}"
	_py python3
}
sha512sums="a7f6fc3b9e741ff8bd64aa04c15c66ac218b520f17b7870068f992dab0794129fbb8a385cdc7e424814a91246110b8b24fa99a20e0d37d9bdedc3bcdc3a8c170  jsonpatch-1.16.tar.gz"
