# Contributor: Erik Johnson <palehose at gmail dot com>
# Maintainer: Jelle van der Waa <jelle@archlinux.org>

pkgbase=python-hglib
pkgname=('python2-hglib' 'python-hglib')
pkgver=1.6
pkgrel=2
arch=('any')
url="https://pypi.python.org/pypi/python-hglib"
license=('MIT')
makedepends=('python2' 'mercurial' 'python')
checkdepends=('python-nose' 'python2-nose')
source=("https://pypi.python.org/packages/source/p/python-hglib/${pkgbase}-${pkgver}.tar.gz")
md5sums=('846fde01feb8891651a4d8dc2f3dd513')

prepare() {
  cp -rf "${pkgbase}-${pkgver}" "${pkgbase}-${pkgver}-2"
}

package_python2-hglib() {
  pkgdesc="python2-hglib is a library with a fast, convenient interface to Mercurial. It uses Mercurial's command server for communication with hg."
  depends=('python2' 'mercurial')
  cd "${srcdir}/${pkgbase}-${pkgver}-2"
  python2 setup.py install --root=${pkgdir} --optimize=1
}

package_python-hglib() {
  pkgdesc="python-hglib is a library with a fast, convenient interface to Mercurial. It uses Mercurial's command server for communication with hg."
  depends=('python' 'mercurial')
  cd "${srcdir}/${pkgbase}-${pkgver}"
  python setup.py install --root=${pkgdir} --optimize=1
}

check() {
  cd "${srcdir}/${pkgbase}-${pkgver}"
  python test.py

  cd "${srcdir}/${pkgbase}-${pkgver}-2"
  python2 test.py
}
