# $Id: PKGBUILD 144958 2015-10-25 11:01:56Z fyan $
# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgbase=httpbin
pkgname=(httpbin python2-httpbin)
pkgver=0.4.0
_commit=c688307868a2ace65b29b1e6d43b593ca154c913
pkgrel=1
pkgdesc="HTTP Request and Response Service"
arch=('any')
url="https://github.com/Runscope/httpbin"
license=('MIT')
makedepends=('python-setuptools' 'python2-setuptools' 'python-flask' 'python2-flask'
             'python-markupsafe' 'python2-markupsafe' 'python-itsdangerous' 'python2-itsdangerous'
             'python-six' 'python2-six' 'python-decorator' 'python2-decorator' 'git')
source=("git+https://github.com/Runscope/httpbin.git#commit=$_commit")
sha256sums=('SKIP')

prepare() {
  cp -a httpbin{,-py2}
}

build() {
  cd "$srcdir/httpbin"
  LC_CTYPE=en_US.UTF-8 python setup.py build

  cd "$srcdir/httpbin-py2"
  python2 setup.py build
}

check() {
  cd "$srcdir/httpbin"
  python test_httpbin.py

  cd "$srcdir/httpbin-py2"
  python2 test_httpbin.py
}

package_httpbin() {
  depends=('python-flask' 'python-markupsafe' 'python-itsdangerous' 'python-six' 'python-decorator')

  cd httpbin
  LC_CTYPE=en_US.UTF-8 python setup.py install -O1 --root="$pkgdir/"

  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

package_python2-httpbin() {
  depends=('python2-flask' 'python2-markupsafe' 'python2-itsdangerous' 'python2-six' 'python2-decorator')

  cd httpbin-py2
  python2 setup.py install -O1 --root="$pkgdir/"

  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

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