# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=py-jellyfish
_pkgname=${pkgname#py-}
pkgver=0.5.6
pkgrel=1
pkgdesc="Python library for approximate and phonetic string matching"
url="https://github.com/jamesturk/jellyfish"
arch="noarch"
license="BSD-2-Clause"
makedepends="python2-dev python3-dev py-setuptools"
subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3"
source="$_pkgname-$pkgver.tar.gz::https://github.com/jamesturk/$_pkgname/archive/$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"
	_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="f8be8a9ff291a2af08632d763ee14de7b87d1dd56b5c7241826f651425bedd076913b335df452659653477682b5c683baa3f716120d0b6af4664454cc045d9ca  jellyfish-0.5.6.tar.gz"
