# Maintainer: Luke Shumaker <lukeshu@parabola.nu>
# Maintainer (AUR:python-pydns): Sebastien Leduc <sebastien@sleduc.fr>
# Contributor (AUR:python-pydns): Samed Beyribey <ras0ir AT eventualis DOT org>

pkgname=python-py3dns
_pkgname=py3dns
pkgver=3.2.1
pkgrel=2
pkgdesc="A module for looking up DNS entries in Python applications"
arch=('any')
url="https://launchpad.net/py3dns"
license=('custom:PSF')

depends=('python')
makedepends=('python-setuptools')

source=("https://launchpad.net/${_pkgname}/trunk/${pkgver}/+download/${_pkgname}-${pkgver}.tar.gz"{,.asc})
md5sums=('35a441081a1acfa0cf78e7ccc2ff9449'
         'SKIP')
validpgpkeys=('E7729BFFBE85400FEEEE23B178D7DEFB9AD59AF1') # Donald Scott Kitterman


_version_constraint() # (dep_pkgname)
{
  local dep_pkgname=$1
  local version=$(pacman -S --print-format='%v' ${dep_pkgname} | tail -n 1)
  version=${version%-*}
  local version_inc=${version%.*}.$(( ${version##*.} + 1 ))

  echo -n "${dep_pkgname}>=${version}" "${dep_pkgname}<${version_inc}"
}


package() {
  depends+=( $(_version_constraint 'python') )

  cd "$srcdir"/$_pkgname-$pkgver

  python setup.py install --root="$pkgdir/" --optimize=1
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
