# $Id: PKGBUILD 143919 2015-10-13 14:44:08Z fyan $
# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgbase=python-planout
pkgname=(python-planout python2-planout)
pkgver=0.5.20151001
_commit=82ccf7b212bd5a292e1485c0942b513a52737c78
pkgrel=1
pkgdesc="A framework for online field experimentation"
arch=('any')
url='http://facebook.github.io/planout'
license=('custom:BSD')
makedepends=('python-six' 'python2-six' 'git')
checkdepends=('python-pytest' 'python2-pytest')
source=("git+https://github.com/facebook/planout.git#commit=$_commit"
        py3k-fix.patch)
sha512sums=('SKIP'
            '1ec44bf082f73045a39076bed7dcf9ce25b79e1f288c5c06136d67894aac262ad309bad4feb0909b5690d3cd67862f3d15c71f51adfcc97a7cc4cc58bc13d78f')

prepare() {
  (cd planout; patch -p1 -i ../py3k-fix.patch)
  cp -a planout{,-py2}
}

build() {
  cd "$srcdir/planout/python"
  python setup.py build

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

check() {
  cd "$srcdir/planout/python/planout/test"
  py.test

  cd "$srcdir/planout-py2/python/planout/test"
  py.test2
}

package_python-planout() {
  depends=('python-six')

  cd planout/python
  python setup.py install -O1 --root "$pkgdir"

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

package_python2-planout() {
  depends=('python2-six')

  cd planout-py2/python
  python2 setup.py install -O1 --root "$pkgdir"

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