# Maintainer: Daniel M. Capella <polyzen@archlinux.org>
# Contributor: Mark Foxwell <fastfret79@archlinux.org.uk>
# Contributor: Nicolas Pouillard [https://nicolaspouillard.fr]
# Contributor: seschwar -- contact via Arch Linux forum or AUR
# Contributor: Ian Denhardt <ian@zenhack.net>

pkgname=alot
pkgver=0.9.1
pkgrel=3
pkgdesc='Terminal-based MUA for the notmuch mail system'
arch=(any)
url=https://github.com/pazz/alot
license=('GPL3')
depends=('desktop-file-utils' 'notmuch' 'python-configobj' 'python-gpgme'
         'python-magic' 'python-setuptools' 'python-twisted' 'python-urwid'
         'python-urwidtrees')
makedepends=('python-sphinx' 'git')
checkdepends=('procps-ng')
source=("$url/archive/$pkgver/alot-$pkgver.tar.gz"
        "alot-$pkgver.tar.gz.asc::$url/releases/download/$pkgver/$pkgver.tar.gz.asc"
        gpg-test-fix.patch::https://github.com/pazz/alot/commit/3446dc44f87d34205b70f44d6ffec9f90b53d77f.patch)
sha512sums=('ac65c742d5bfb4827482c881ec2eb95b9215e9a5c49d7001421d62ffb1f38c7792dbbf94c0f16578da70b5ce15ba7a28cea0c1bbd34080f8132c80f4a0a2199b'
            'SKIP'
            'c17af3dc44256b187eb497c1762a2afeb841d4bdd4c7b125ec9ff4293c81d913dbae01fe10534ed8d11f421235e1bfb46872354e49ba8d7942dfc5599f16cb96')
validpgpkeys=('B7838D65FEE80DED1DCA494D94340367D7D6C5AA') # Patrick Totzke

prepare() {
  cd alot-$pkgver
  # The Arch Linux package python-magic's egg calls itself "file-magic",
  # as opposed to the python-magic on PyPI.
  sed -i 's/python-magic/file-magic/' setup.py
}

build() {
  cd alot-$pkgver
  python setup.py build
  make -C docs man
}

check() {
  cd alot-$pkgver
  python setup.py test
}

package() {
  cd alot-$pkgver
  python setup.py install --optimize=1 --root="$pkgdir" --skip-build
  install -Dm644 -t "$pkgdir"/usr/share/man/man1 docs/build/man/alot.1
  install -Dm644 -t "$pkgdir"/usr/share/applications extra/alot*.desktop
  install -Dm644 extra/completion/alot-completion.zsh \
    "$pkgdir"/usr/share/zsh/functions/_alot
  install -Dm644 -t "$pkgdir"/usr/share/alot/themes \
    extra/themes/{mutt,solarized_light,solarized_dark,sup,tomorrow}
}

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