git » python-shtab.git » commit 96a7a61

new upstream release & FS#75708

author George Rawlinson
2023-05-13 09:11:57 UTC
committer George Rawlinson
2023-05-13 09:11:57 UTC
parent b8e490f66f707042691497de739a0fe93d44dce5

new upstream release & FS#75708

PKGBUILD +19 -3

diff --git a/PKGBUILD b/PKGBUILD
index 89fe935..e1d28f8 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,8 +2,8 @@
 # Contributor: SZanko, szanko at protonmail dot com
 
 pkgname=python-shtab
-pkgver=1.6.0
-pkgrel=2
+pkgver=1.6.1
+pkgrel=1
 pkgdesc='Automagic shell tab completion for Python CLI applications'
 arch=('any')
 url='https://github.com/iterative/shtab'
@@ -21,7 +21,7 @@ checkdepends=(
   'python-pytest-cov'
   'python-pytest-timeout'
 )
-_commit='68ac16999be08cf5033c601f162020bde4aaf0ad'
+_commit='80a105058bafd32c0669eb2e2b477502f195c48e'
 source=("$pkgname::git+$url#commit=$_commit")
 b2sums=('SKIP')
 
@@ -35,6 +35,18 @@ build() {
   cd "$pkgname"
 
   python -m build --wheel --no-isolation
+
+  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
+
+  # install to temporary directory
+  python -m installer --destdir="$PWD/tmp_install" dist/*.whl
+
+  export PYTHONPATH="$PWD/tmp_install$site_packages"
+
+  # generate shell completions
+  for shell in bash zsh; do
+    python -m shtab --print-own-completion "$shell" > "$shell.completion"
+  done
 }
 
 check() {
@@ -48,6 +60,10 @@ package() {
 
   python -m installer --destdir="$pkgdir" dist/*.whl
 
+  # completions
+  install -vDm644 bash.completion "$pkgdir/usr/share/bash-completion/completions/shtab"
+  install -vDm644 zsh.completion "$pkgdir/usr/share/zsh/site-functions/_shtab"
+
   # license
   install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENCE
 }