# $Id: PKGBUILD 137926 2015-08-04 09:34:06Z tredaelli $
# Maintainer: Timothy Redaelli <timothy.redaelli@gmail.com>
# Contributor: Andy Weidenbaum <archbaum@gmail.com>
# ThomasV PGP key: gpg --recv-key 6694D8DE7BE8EE5631BED9502BD5824B7F9470E6
# http://bitcoin-otc.com/viewgpg.php?nick=ThomasV

pkgname=electrum
pkgver=2.4
pkgrel=1
pkgdesc="Lightweight Bitcoin wallet"
arch=('any')
depends=('python2-ecdsa' 'python2-pbkdf2' 'python2-requests' 'python2-pyasn1' 'python2-pyasn1-modules' 'python2-qrcode'
         'python2-protobuf' 'python2-tlslite' 'python2-dnspython' 'python2-pyqt4' 'python2-sip' 'python2-slowaes')
makedepends=('gettext' 'python2-pycurl' 'python2-setuptools' 'desktop-file-utils')
optdepends=('python2-btchip: BTChip hardware wallet support'
            'python2-matplotlib: plot transaction history in graphical mode'
            'zbar: QR code reading support')
url="https://electrum.org"
license=('GPL3')
source=("https://download.electrum.org/${pkgname^}-${pkgver}.tar.gz"{,.asc})
md5sums=('e0cc0724bb4510d16330505b908d1312'
         'SKIP')
sha256sums=('5dceb6136f1ea27f950f84dabc3d03d986be37ad7bcd8d77d2c3834056a90478'
            'SKIP')
validpgpkeys=('6694D8DE7BE8EE5631BED9502BD5824B7F9470E6')

provides=('electrum')
install=electrum.install

prepare() {
  cd ${pkgname^}-${pkgver}

  find . -type f -exec sed -i 's#/usr/bin/python#/usr/bin/python2#g' {} +
  find . -type f -exec sed -i 's#/usr/bin/env python#/usr/bin/env python2#g' {} +
}

build() {
  cd ${pkgname^}-${pkgver}

  pyrcc4 icons.qrc -o gui/qt/icons_rc.py
  python2 setup.py build
}

package() {
  cd ${pkgname^}-${pkgver}

  python2 setup.py install --root="${pkgdir}" --optimize=1
}
