# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-fs
pkgver=2.4.16
pkgrel=3
pkgdesc="Filesystem abstraction layer"
arch=('any')
license=('BSD')
url="https://pypi.python.org/pypi/fs/"
depends=('python-appdirs' 'python-pytz' 'python-setuptools' 'python-six')
checkdepends=('python-pytest-runner' 'fuse2' 'python-pyftpdlib' 'python-psutil'
              'python-parameterized')
source=("https://github.com/PyFilesystem/pyfilesystem2/archive/v$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('24a50fdbb668916e19ef26b21feb345beb6d734e841435de2bef32672e4f6b8329a44e827b6d3bb878c2522098499dea4915adcfa381b0a3c9e20f8c4f7352bb')

build() {
  cd pyfilesystem2-$pkgver
  python setup.py build
}

check() {
  cd pyfilesystem2-$pkgver
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  python setup.py install --root="$PWD/tmp_install" --optimize=1
  PYTHONPATH="$PWD/tmp_install$site_packages:$PYTHONPATH" python setup.py pytest
}

package() {
  cd pyfilesystem2-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1
  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
