# $Id$
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Daniel Wallace <danielwallace at gtmanfred dot com>
# Contributor: Thomas S Hatch <thatch45@gmail.com>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - drop makedepend on pypandoc

pkgbase=python-pybuilder
pkgname=('python-pybuilder' 'python2-pybuilder')
pkgver=0.11.10
pkgrel=1
pkgdesc='An extensible, easy to use continuous build tool for Python'
arch=('any')
url='http://pybuilder.github.io'
license=('Apache')
makedepends=('python-pip' 'python2-pip' 'python-tblib' 'python2-tblib' 'python-wheel'
             'python2-wheel' 'python2-mock' 'python-cram' 'python2-cram' 'flake8' 'python2-flake8'
             'python-sphinx' 'python2-sphinx' 'python-pdoc' 'python2-pdoc' 'python-coverage'
             'python2-coverage' 'python-pytddmon' 'python2-pytddmon' 'python2-snakefood'
             'python-unittest-xml-reporting' 'python2-unittest-xml-reporting'
             'python-pyfix' 'python2-pyfix')
source=("$pkgbase-$pkgver.tar.gz::https://github.com/pybuilder/pybuilder/archive/v$pkgver.tar.gz")
sha512sums=('5004855a436b4dfc149aec77876b230a98a532495d3f76f34b28964c1046d06a14825aa3d38528bac1bf10a0d8a1b139ee85b35f42fd5fd2f36dfd551b76505c')

prepare() {
  sed -i 's/"install_dependencies", //' pybuilder-$pkgver/setup.py

  cp -a pybuilder-$pkgver{,-py2}
}

check() {
  cd "$srcdir"/pybuilder-$pkgver
  python build.py -v analyze || warning "ignoring flake8 warnings"

  cd "$srcdir"/pybuilder-$pkgver-py2
  python2 build.py -v analyze || warning "ignoring flake8 warnings"
}

package_python-pybuilder() {
  depends=('python-pip' 'python-tblib' 'python-wheel')

  cd pybuilder-$pkgver
  python setup.py install --root="$pkgdir" -O1
}

package_python2-pybuilder() {
  depends=('python2-pip' 'python2-tblib' 'python2-wheel')

  cd pybuilder-$pkgver-py2
  python2 setup.py install --root="$pkgdir" -O1

  mv "$pkgdir"/usr/bin/pyb{,2}
  mv "$pkgdir"/usr/bin/pyb_{,2}
}