# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Andrey Mikhaylenko <neithere at gmail dot com>

pkgname=python-argcomplete
_pyname=argcomplete
pkgver=3.1.1
pkgrel=1
pkgdesc='Easy, extensible command line tab completion of arguments for your Python script'
url='https://github.com/kislyuk/argcomplete'
arch=('any')
license=('Apache-2.0')
depends=('python')
makedepends=('git' 'python-build' 'python-installer' 'python-setuptools-scm' 'python-wheel')
checkdepends=('fish' 'python-pexpect' 'python-pip' 'tcsh' 'zsh')
source=(${_pyname}::"git+$url?signed#tag=v$pkgver")
sha512sums=('5431f1c9309d6e29f5d867744245647214c0a5ce00dc516aef21e7de89881d15ff04fe1e33c3d43f256021e5670cd4d3e3cdab589e03147d68bb6b88563bd3ca')
validpgpkeys=('29BCBADB4ECAAAC2382699388AFAFCD242818A52') # Andrey Kislyuk <kislyuk@gmail.com>

pkgver() {
  cd ${_pyname}
  git describe --tags --match 'v*' | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

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

check() {
  cd ${_pyname}
  # workaround for https://github.com/kislyuk/argcomplete/issues/337
  echo "set enable-bracketed-paste off" > .inputrc
  INPUTRC=$PWD/.inputrc python test/test.py -v
}

package() {
  cd ${_pyname}
  python -m installer --destdir="$pkgdir" dist/*.whl
}

# vim: ts=2 sw=2 et:
