# Description: CLI calendar application build around CalDAV
# URL: https://lostpackets.de/khal/
# Maintainer: Tim Biermann, tbier at posteo dot de
# Depends on: python3-atomicwrites python3-click-log python3-configobj python3-icalendar python3-pytz-deprecation-shim python3-pyxdg python3-tzlocal python3-urwid

name=khal
version=0.14.0
release=1
source=(https://files.pythonhosted.org/packages/source/k/$name/$name-$version.tar.gz)

build() {
  cd $name-$version

  /usr/bin/python3 -m build --wheel --skip-dependency-check --no-isolation
  /usr/bin/python3 -m installer --compile-bytecode 2 --destdir=$PKG dist/*.whl

  if prt-get isinst bash-completion; then
     mkdir -p $PKG/usr/share/bash-completion/completions
     _KHAL_COMPLETE=bash_source khal >> $PKG/usr/share/bash-completion/completions/khal.bash
  fi

  if prt-get isinst zsh; then
     mkdir -p $PKG/usr/share/zsh/site-functions
     _KHAL_COMPLETE=zsh_source khal >> $PKG/usr/share/zsh/site-functions/_khal
  fi
}
