# $Id: PKGBUILD 122874 2014-11-21 17:57:17Z fyan $
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Alexander Rødseth <rodseth@gmail.com>
# Contributor: Jan de Groot <jgc@archlinux.org>
# Contributor: Giorgio Lando <patroclo7@gmail.com>
# Contributor: Nicolas Quienot <niQo@aur>
# Contributor: Jesse Young <jesse.young@gmail.com>
# Contributor: Anton Eliasson <devel@antoneliasson.se>

pkgbase=python-httplib2
pkgname=(python-httplib2 python2-httplib2)
pkgver=0.9
pkgrel=3
pkgdesc='Comprehensive HTTP client library, supporting many features'
url='https://github.com/jcgregorio/httplib2'
license=('MIT')
arch=('any')
makedepends=('python-setuptools' 'python2-setuptools' 'git')
depends=('ca-certificates')
provides=('httplib2')
replaces=('httplib2')
#source=("git://github.com/jcgregorio/httplib2.git#tag=v$pkgver"
source=("git://github.com/jcgregorio/httplib2.git#commit=7d1b88a3cf"
        'ssl_hostname.patch'
        'cert.patch')
sha256sums=('SKIP'
            'd29fa108291a24f0708f04867f0479247ecbdd1fcf1617588b6650038d95554a'
            'ba05f491fd07afec6abc6bccb08369906f8e6f1a808d94a54fe4e7be7d9771d9')

prepare() {
  pushd "${pkgbase/python-}"

  # Patch, ref FS#36839
  patch -p1 -i "$srcdir/ssl_hostname.patch"

  # Patch, ref FS#40179
  patch -p1 -i "$srcdir/cert.patch"

  popd

  # Prepare one build directory for each package
  cp -a "${pkgbase/python-}" "${pkgname[0]}"
  cp -a "${pkgbase/python-}" "${pkgname[1]}"
}

package_python-httplib2() {
  depends=('python')

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

package_python2-httplib2() {
  depends=('python2')

  cd "$pkgname"
  python2 setup.py install -O1 --root="$pkgdir"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

# vim:set ts=2 sw=2 et:
