# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
setvar pkgname = 'py-parsing'
setvar _pkgname = 'pyparsing'
setvar pkgver = '2.2.0'
setvar pkgrel = '0'
setvar pkgdesc = ""An object-oriented approach to text processing""
setvar url = ""http://pyparsing.wikispaces.com/""
setvar arch = ""noarch""
setvar license = ""MIT""
setvar makedepends = ""python2-dev python3-dev py-setuptools""
setvar subpackages = ""py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3""
setvar source = ""https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz""
setvar builddir = ""$srcdir"/$_pkgname-$pkgver"

proc build {
	cd $builddir
	python2 setup.py build || return 1
	python3 setup.py build || return 1
}

proc package {
	mkdir -p $pkgdir
}

proc _py2 {
	setvar replaces = "$pkgname"
	_py python2
}

proc _py3 {
	_py python3
}

proc _py {
	local python="$1"
	setvar pkgdesc = ""$pkgdesc (for $python)""
	setvar depends = ""$depends $python""
	setvar install_if = ""$pkgname=$pkgver-r$pkgrel $python""

	cd $builddir
	$python setup.py install --prefix=/usr --root="$subpkgdir"
}

setvar sha512sums = ""6a409f429d40a5ac202d144e4150de2c80d7c7120147f603f72a4a99797d48c50822a6437f590ec5ae4418d51aa1f6b1d4e5d95a57e19bec0a127b04e4937008  pyparsing-2.2.0.tar.gz""