# 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.11.2
release=1
source=(https://files.pythonhosted.org/packages/source/k/$name/$name-$version.tar.gz)

build() {
  cd $name-$version

  /usr/bin/python3 setup.py build
  /usr/bin/python3 setup.py install \
    --prefix=/usr \
    --optimize=1 \
    --skip-build \
    --root=$PKG

  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
}
