# Maintainer: Thore Bödecker <foxxx0@archlinux.org>
# Contributor: brent s. <bts[at]square-r00t[dot]net>
# Contributor: Alexander Phinikarides <alexisph _AT_ gmail _DOT_ com>

pkgbase='python-pyroute2'
_pkgbase="${pkgbase//python-/}"
pkgname=("python-${_pkgbase}")
pkgdesc="A pure Python netlink and Linux network configuration library"
pkgver=0.5.19
pkgrel=3
arch=('any')
url="https://docs.pyroute2.org/"
license=('GPL2' 'Apache')
depends=('python')
makedepends=('python' 'python-setuptools' 'python-setuptools-scm' 'python-sphinx' 'git' 'python-aafigure' 'twine')
source=("https://files.pythonhosted.org/packages/source/${_pkgbase:0:1}/${_pkgbase}/${_pkgbase}-${pkgver}.tar.gz")
# source=("${_pkgbase}-${pkgver}.tar.gz::https://github.com/svinota/${_pkgbase}/archive/${pkgver}.tar.gz"
#        'fix_sphinx_css.patch')
sha512sums=('bd60e2adf59b8438ff4f6abf2d41cf18eb60dcef3072577648488db45ffe89bd9c7207c4eccc38eb9256533ea2950e7f20b82ae4940b1207ba71d0f261e83f6d')

prepare() {
  cd "${srcdir}/${_pkgbase}-${pkgver}"
  :
}

build() {
  cd "${srcdir}/${_pkgbase}-${pkgver}"
  python setup.py build
}

check() {
  cd "${srcdir}/${_pkgbase}-${pkgver}"
  python setup.py check
}

package() {
  cd "${srcdir}/${_pkgbase}-${pkgver}"
  python setup.py install --root="${pkgdir}/" --optimize=1
  # Tests get installed into the package for some reason
  PYTHON_STDLIB="$(python -c "from sysconfig import get_path; print(get_path('stdlib'))")"
  rm -rf "${pkgdir%/}/${PYTHON_STDLIB#/}/site-packages/tests"
}

# vim:set ts=2 sw=2 et:
