# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=py-pam
_pkgname=PyPAM
_id="f1e7c2c56421dda28a75ace59a3c8871"
pkgver=0.5.0
pkgrel=1
pkgdesc="A Python interface to the PAM library"
url="https://launchpad.net/ubuntu/quantal/+source/python-pam"
arch="all"
license="LGPL-2.1"
depends="linux-pam"
makedepends="python2-dev py-setuptools python3-dev linux-headers linux-pam-dev"
subpackages="py3-${pkgname/py-/}:_py3 py2-${pkgname/py-/}:_py2"
source="http://pkgs.fedoraproject.org/lookaside/pkgs/$_pkgname/$_pkgname-$pkgver.tar.gz/$_id/$_pkgname-$pkgver.tar.gz
PyPAM-0.5.0-dealloc.patch
PyPAM-0.5.0-nofree.patch
PyPAM-0.5.0-memory-errors.patch
PyPAM-0.5.0-return-value.patch
PyPAM-python3-support.patch
pypam-0.5.0-stricter.patch"
builddir="$srcdir"/$_pkgname-$pkgver

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

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

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

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

_py3() {
	_py python3
}

md5sums="f1e7c2c56421dda28a75ace59a3c8871  PyPAM-0.5.0.tar.gz
1c893c85d63378bb05d8cd07bffc97e7  PyPAM-0.5.0-dealloc.patch
0663d74895ca602bf184e1898a34116d  PyPAM-0.5.0-nofree.patch
9ee809416aa3ab00655043f01cd3522f  PyPAM-0.5.0-memory-errors.patch
6a7ea0a074f5b51598da4ee3bbbb95ee  PyPAM-0.5.0-return-value.patch
ad43b2cbee367cdcb9c6fbd0d3c1cf48  PyPAM-python3-support.patch
da0356df36055b1175e14643d6163e01  pypam-0.5.0-stricter.patch"
sha256sums="796ac019b9ee805696d0d277d8fb912fa2391b6ac070dc6f9f1a9a0fadbc3a5a  PyPAM-0.5.0.tar.gz
5d73ad2efb9b5f0507c1968aa69bcc36d3981e5c02117215982abbb6825863de  PyPAM-0.5.0-dealloc.patch
ed2964fbc2c0d8b23961cf3a9b5b77d8c4609de54ef0e557ecb64664497f8ff9  PyPAM-0.5.0-nofree.patch
e500628d9ccae7c953967a70a97b3af94c5f6c52849b6615b0d1270789a1d08a  PyPAM-0.5.0-memory-errors.patch
8a5a7292b415b053a69ccb36f7cd5dfd367f273b0ca8cf1f1bcec96f05769b3e  PyPAM-0.5.0-return-value.patch
e51058c0869eb0b5364c1978f865ceea01f8b9e9957695629ce61bf8417838b0  PyPAM-python3-support.patch
ad12759aeb86af08c590c91995ef36ee8e887523f8a2cf49b28e1e9034608d6c  pypam-0.5.0-stricter.patch"
sha512sums="9e0e919e34930d2283307cd6665c5287c664a76a5de56367bd975867ac26b376ae03d30cb3bc4a16390c977ca2690cfd2e90ac73dcc7886b8c999444da4a07e0  PyPAM-0.5.0.tar.gz
105573489be31763ed01bab02ccaf7147c73b196d85d8318eceda145e86fb5c3fa3a59b7baee9d85f6d5ae40df0335689267650461f5440a9c2991954c367e8e  PyPAM-0.5.0-dealloc.patch
7292483d60f75d577055f4bf7380b110620669a19b3e2e3a4700e2c816758af865213cf19b329260338e82f9a0cba03a14dea06ba636251f1436ec0c3373f751  PyPAM-0.5.0-nofree.patch
358e57ba6450b533cbdb39f559813767799e387937a610b15e5e8e78d59b6501785c40c3ffdc5b1914ff6c9220716cdf9b537847373379eb94094f6ffe23c7f5  PyPAM-0.5.0-memory-errors.patch
73d81d9a7398933011eba0739e3bce7651c3da1bf38f77b510172e26f569d329c3b28e5192a25ee0616875ddad52e67697dabe021d31cc5e51e9e78941333c8d  PyPAM-0.5.0-return-value.patch
4dd78df5984601cf47aebaa77665730c32b4f0550feb8c12af4b145643584aad9d4b184b2c8fb67cc0503ad791a1d772a01db478795407b5c755dcbd172dabd0  PyPAM-python3-support.patch
8a059951cc219278a36e7e0ec50aba2799d664f74389735e3b32ff2bd7fd45e0d712d0487662879bc07b3bd7fdf74acae7c459dfc16731ad90e8e83b2c215cbd  pypam-0.5.0-stricter.patch"
