# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Jingbei Li <i@jingbei.li>
# Contributor: Jose Riha <jose1711 gmail com>

pkgname=python-pooch
_pyname=pooch
pkgver=1.8.1
pkgrel=1
pkgdesc='Python library for fetching and caching data files'
arch=(any)
url='https://www.fatiando.org/pooch/latest/'
license=(LicenseRef-pooch)
depends=(python
         python-packaging
         python-platformdirs
         python-requests)
optdepends=('python-paramiko: for SFTP downloads'
            'python-tqdm: for printing a download progress bar')
makedepends=(python-build
             python-installer
             python-setuptools-scm
             python-wheel)
checkdepends=(python-pytest
              python-pytest-httpserver)
source=(https://pypi.python.org/packages/source/${_pyname:0:1}/$_pyname/$_pyname-$pkgver.tar.gz)
sha256sums=('27ef63097dd9a6e4f9d2694f5cfbf2f0a5defa44fccafec08d601e731d746270')

build() {
  cd $_pyname-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd $_pyname-$pkgver
  pytest -v -k 'not test_check_availability_on_ftp and not test_ftp_downloader'
}

package() {
  cd $_pyname-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE.txt "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
