# Maintainer: Bruno Pagani <archange@archlinux.org>

_pkg=spur
pkgname=python-${_pkg}
pkgver=0.3.23
pkgrel=5
pkgdesc="Run commands and manipulate files locally or over SSH using the same interface"
arch=(any)
url="https://github.com/mwilliamson/spur.py"
license=(BSD)
makedepends=(python-setuptools)
depends=(python python-paramiko)
checkdepends=(python-pytest)
# No tests in pypi tarballs
#source=(https://files.pythonhosted.org/packages/source/${_pkg::1}/${_pkg}/${_pkg}-${pkgver}.tar.gz)
source=(${url}/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha256sums=('613fcc44f731a041841485a52780c94490e59c353952c2c8491ec045a2e5d805')

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

check() {
  cd ${_pkg}.py-${pkgver}
  TEST_SSH_USERNAME=arch TEST_SSH_PASSWORD='' pytest tests/local_tests.py
  # Other tests require a functioning sshd server
  # https://github.com/mwilliamson/spur.py/blob/5d25003250dc16cb626cc476d416a8abcd6c112e/CONTRIBUTING.rst
}

package() {
  cd ${_pkg}.py-${pkgver}
  python setup.py install --prefix=/usr --root="${pkgdir}" --optimize=1 --skip-build
  # Install license file
  install -Dm644 LICENSE -t "${pkgdir}"/usr/share/licenses/${pkgname}/
}
