# $Id$
# Maintainer: Luke Shumaker <lukeshu@lukeshu.com>
# Maintainer (arch:python-psycopg2): Sergej Pupykin <pupykin.s+arch@gmail.com>
# Maintainer (arch:python-psycopg2): Angel 'angvp' Velasquez <angvp[at]archlinux.com.ve>
# Maintainer (arch:python-psycopg2): Douglas Soares de Andrade <dsa@aur.archlinux.org>

# Rational for inclusion in [libre]:
#  - Used by libre/parabolaweb-utils

pkgbase=python-psycopg2
pkgname=('python-psycopg2' 'python2-psycopg2')
pkgbase=${pkgbase}.6
pkgname=("${pkgname[@]/%/.6}")
_gitver=4ae2a366109e6f7258728d46ec34e26cf91d53b7
pkgver=2.6.3dev0.rev21.git4ae2a366
pkgrel=1
pkgdesc="A PostgreSQL database adapter for the Python programming language."
arch=('i686' 'x86_64')
arch+=('armv7h')
url="http://initd.org/psycopg/"
license=('LGPL3')
makedepends=('python2' 'python' 'postgresql-libs>=8.4.1')
makedepends+=('git')
source=("psycopg2-$pkgver::git+https://github.com/psycopg/psycopg2.git#commit=${_gitver}")
sha256sums=('SKIP')

pkgver() {
  cd "$srcdir/psycopg2-$pkgver"
  echo "$(python setup.py --version|sed -r 's/\.([a-z])/\1/')$(git describe --tags|sed -r -e 's/-g/.git/' -e 's/.*-/.rev/')"
}

build() {
  cd "$srcdir/psycopg2-$pkgver"
  sed -i 's/,PSYCOPG_DEBUG$//' setup.cfg
}

package_python-psycopg2.6() {
  depends=('python' 'postgresql-libs>=8.4.1')
  provides=("python-psycopg2=$pkgver")
  conflicts=('python-psycopg2')

  cd "$srcdir/psycopg2-$pkgver"
  python setup.py install --root="$pkgdir"
}

package_python2-psycopg2.6() {
  depends=('python2' 'postgresql-libs>=8.4.1')
  provides=("python2-psycopg2=$pkgver")
  conflicts=('python2-psycopg2')

  cd "$srcdir/psycopg2-$pkgver"
  python2 setup.py install --root="$pkgdir"
}
