# Maintainer: Lukas Fleischer <archlinux at cryptocrack dot de>
# Contributor: Danilo Bargen <gezuru@gmail.com>

pkgname=vim-jedi
_reponame=jedi-vim
pkgver=0.7.0
pkgrel=5
pkgdesc='Vim plugin for jedi, an awesome Python autocompletion.'
arch=('any')
url="https://github.com/davidhalter/${_reponame}"
license=('MIT')
depends=('vim' 'python-jedi' 'python')
optdepends=('vim-supertab: for tab completion'
            'python2-jedi: for Python 3 support')
groups=('vim-plugins')
source=("https://github.com/davidhalter/${_reponame}/archive/${pkgver}.tar.gz"
        '4724e18b633e54dbaac39759770601cc1979893a.patch'
	'd9a43db019da0390406e34cb161a61fba43bf250.patch')
sha256sums=('cb1b157800024f587e227cd901762963a98e1242eba070875d4aac9f08c0c11e'
            'e6f252574b65a0fbcfb8a8c771d0eb00e0f7aadae10a24623169a27b1cf64852'
            'b228a592aee79f346bd3ee98743394a25790fcbb48ccc69bb1413a58f1bcb41c')
install=${pkgname}.install

prepare() {
  cd "$srcdir/$_reponame-$pkgver"

  patch -p1 -i ../d9a43db019da0390406e34cb161a61fba43bf250.patch
  patch -p1 -i ../4724e18b633e54dbaac39759770601cc1979893a.patch
}

package() {
  cd "$srcdir/$_reponame-$pkgver"

  install -d "${pkgdir}/usr/share/vim/vimfiles"

  cp -dp --no-preserve=ownership jedi_vim.py initialize.py "${pkgdir}/usr/share/vim/vimfiles/"
  cp -dpr --no-preserve=ownership after "${pkgdir}/usr/share/vim/vimfiles/after"
  cp -dpr --no-preserve=ownership autoload "${pkgdir}/usr/share/vim/vimfiles/autoload"
  cp -dpr --no-preserve=ownership ftplugin "${pkgdir}/usr/share/vim/vimfiles/ftplugin"
  cp -dpr --no-preserve=ownership plugin "${pkgdir}/usr/share/vim/vimfiles/plugin"

  # install license file
  install -Dm0644 LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
