# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Andrey Mikhaylenko <neithere at gmail dot com>

pkgname=python-argcomplete
_pyname=argcomplete
pkgver=3.4.0
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#tag=v$pkgver")
sha512sums=('99a3b9f6c0572b309f2da8846cceb89e6a8f03eb3bd17b5695a8a4a34a2d71e4e68ac283ec5a0e90eb50df3b4c095417faccec2fd607a5ac81219190cb489e58')
validpgpkeys=('29BCBADB4ECAAAC2382699388AFAFCD242818A52') # Andrey Kislyuk <kislyuk@gmail.com>

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

check() {
  cd ${_pyname}
  python test/test.py -v
}

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

  # Disabled again, see https://gitlab.archlinux.org/archlinux/packaging/packages/python-argcomplete/-/issues/3
  # local _site_packages=$(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
  # install -dm755 "$pkgdir"/usr/share/bash-completion/completions "$pkgdir"/usr/share/zsh/site-functions
  # ln -s ../../../..${_site_packages}/argcomplete/bash_completion.d/_python-argcomplete -t "$pkgdir"/usr/share/bash-completion/completions/
  # ln -s ../../../..${_site_packages}/argcomplete/bash_completion.d/_python-argcomplete -t "$pkgdir"/usr/share/zsh/site-functions/
}

# vim: ts=2 sw=2 et:
