# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
# Contributor: Michał Masłowski <mtjm@mtjm.eu>
# Contributor: bill-auger <bill-auger@programmer.net>


pkgname=h-client
pkgver=0.0a0.dev134
pkgrel=2
epoch=1
pkgdesc="A client for an h-source server (such as https://www.h-node.org/)"
arch=('any')
url="https://savannah.nongnu.org/projects/h-client/"
license=('GPL3')
depends=('python2' 'python2-distribute' 'python2-pycurl' 'pygtk' 'pciutils' 'usbutils')
makedepends=('subversion')
options=(!emptydirs)
source=("svn+http://svn.savannah.nongnu.org/svn/${pkgname}/trunk/${pkgname}"
        'fix_test.patch')
sha256sums=('SKIP'
            'f80a2a5971c091093c8ce4a8d963ace36383e7bd819b98c9c86846fb82db9e0d')


prepare()
{
  cd "${srcdir}"/${pkgname}

  sed -i "s/dev/dev134/g" setup.cfg
  sed -i "s/tag_svn_revision = 1//g" setup.cfg
  sed -i "s/'h-node.org'/'https:\/\/h-node.org'/g" hclient/gtkclient.py

  echo "applying fix_test.patch"
  patch -Np1 -i "${srcdir}"/fix_test.patch
}

build()
{
  cd "${srcdir}"/${pkgname}

  make
}

check()
{
  cd "${srcdir}"/${pkgname}

  python2 setup.py test
}

package()
{
  cd "${srcdir}"/${pkgname}

  python2 setup.py install --root="${pkgdir}"/ --optimize=1
  make DESTDIR="${pkgdir}" prefix=/usr install-data
}
