# Maintainer (Arch): Michael Düll <mail@akurei.me>

pkgname=python2-potr
pkgver=1.0.1
pkgrel=1
pkgdesc="This is a pure Python2 OTR implementation; it does not bind to libotr."
arch=(any)
url="https://github.com/afflux/pure-python-otr"
license=('LGPL')
depends=('python2' 'python2-crypto')
conflicts=('python-potr-git' 'python-potr')
replaces=('python-potr')
#options=(!emptydirs)
source=("https://github.com/python-otr/pure-python-otr/archive/${pkgver}.tar.gz")
sha512sums=('db76af179d6ed7276ecdca7f16da8e1ed4e2454ce66a269016833c87a512e165bea6afd3b2785f863d183611530a0f6c3793f1620be1f01ab6bb6c3963b874da')

PYTHON=`which python2`

prepare() {
  cd $srcdir/pure-python-otr-${pkgver}
  set_python2
}

package() {
  cd $srcdir/pure-python-otr-${pkgver}
  $PYTHON ./setup.py install --root=$pkgdir/
}

# To use python2 instead of default python v3.
set_python2() {
  for file in $(find . -name '*.py' -print); do
    sed -i 's_^#!.*/usr/bin/python_#!/usr/bin/python2_' "${file}"
    sed -i 's_^#!.*/usr/bin/env.*python_#!/usr/bin/env python2_' "${file}"
  done
}


# vim:set ts=2 sw=2 et: