# Maintainer: Lukas Fleischer <lfleischer@archlinux.org>
# Contributor: Brendan MacDonell <macdonellba at gmail dot com>

pkgbase=python-llfuse
pkgname=(python-llfuse python2-llfuse)
pkgver=1.3.5
pkgrel=1
pkgdesc="A set of Python bindings for the low level FUSE API."
arch=('x86_64')
url="https://bitbucket.org/nikratio/python-llfuse/"
license=('LGPL')
depends=('fuse2')
makedepends=('python-setuptools' 'python2-setuptools' 'python2-contextlib2' 'cython')
checkdepends=('python-pytest' 'python2-pytest')
options=(!emptydirs)
source=("https://bitbucket.org/nikratio/python-llfuse/downloads/llfuse-${pkgver}.tar.bz2")
md5sums=('9fbb82c0db909d139f9fafa27c76781e')

build() {
  cd "${srcdir}/llfuse-${pkgver}"

  python setup.py build
  python2 setup.py build
}

check() {
  cd "${srcdir}/llfuse-${pkgver}"

  set -x
  pythonpath=("$PWD/build/lib.linux-$CARCH"-3* "$PWD/build/lib.linux-$CARCH"-2*)
  PYTHONPATH="${pythonpath[0]}" python -m pytest
  PYTHONPATH="${pythonpath[1]}" python2 -m pytest
  set +x
}

package_python-llfuse() {
  depends+=(python)

  cd "${srcdir}/llfuse-${pkgver}"
  python setup.py install --root="$pkgdir" --optimize=1
}

package_python2-llfuse() {
  depends+=(python2-contextlib2)

  cd "${srcdir}/llfuse-${pkgver}"
  python2 setup.py install --root="$pkgdir" --optimize=1
}
