# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Angel Velasquez <angvp@archlinux.org>
# Contributor: Douglas Soares de Andrade <douglas@archlinux.org>
# Contributor: Mario Danic <mario.danic@gmail.com>

pkgname=python-paramiko
pkgver=3.5.1
pkgrel=1
pkgdesc="Python module that implements the SSH2 protocol"
url="https://github.com/paramiko/paramiko/"
license=('LGPL')
arch=('any')
depends=('python-bcrypt' 'python-cryptography' 'python-pynacl')
makedepends=('python-setuptools' 'python-bcrypt' 'python-cryptography' 'python-pynacl')
checkdepends=('python-pytest-relaxed' 'python-pyasn1' 'python-invoke' 'python-lexicon' 'python-icecream')
optdepends=('python-invoke: config support'
            'python-gssapi: GSS-API/SSPI support'
            'python-pyasn1: GSS-API/SSPI support')
source=(
  "https://github.com/paramiko/paramiko/archive/$pkgver/$pkgname-$pkgver.tar.gz"
)
sha512sums=('a1198f7f21cfbdbb843acb59cc431f9af0a47d687a7e9702244f36b555bb37b75149c0e22302040400f20df50dee1d83154e5acd582982ca44f6cf68ff592675')

prepare() {
  cd paramiko-$pkgver
  # Devendor test setup
  sed -i "s/from invoke.vendor.lexicon import Lexicon/from lexicon import Lexicon/" tests/conftest.py
}

check() {
  cd paramiko-$pkgver
  LANG=en_US.UTF-8 pytest
}

package() {
  cd paramiko-$pkgver

  python setup.py install --root="$pkgdir" --optimize=1
  install -dm755 "$pkgdir"/usr/share/doc/$pkgname/demos
  install -m644 demos/* "$pkgdir"/usr/share/doc/$pkgname/demos
  chmod 755 "$pkgdir"/usr/share/doc/$pkgname/demos/*.py
}
