# $Id$
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: mutantmonkey <aur@mutantmonkey.in>
# Contributor: Techlive Zheng <techlivezheng@gmail.com>

pkgname=obfsproxy
pkgver=0.2.13
pkgrel=1
pkgdesc="A pluggable transport proxy written in Python"
arch=('any')
url="https://pypi.python.org/pypi/obfsproxy"
license=('BSD')
depends=('python2-crypto' 'python2-pyptlib' 'python2-twisted'
         'python2-yaml' 'python2-setuptools')
optdepends=('python2-gmpy2: speed up some cryptographic operations')
conflicts=('pyobfsproxy' 'obfsproxy-git')
options=('!emptydirs')
source=("https://pypi.python.org/packages/source/o/obfsproxy/obfsproxy-${pkgver}.tar.gz"{,.asc})
sha256sums=('1e26c2faef1cfcf856ddf60e9647058a7c78fb0d47f05b58a0f847ed7cc41a66'
            'SKIP')
validpgpkeys=('13C81580203AE18BB7C0424E09CC7F5315F271D9')  # George Kadianakis

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

  # argparse is part of python 2.7+, so we can remove it from install_requires
  sed -i "/'argparse',/d" setup.py
  
  find . -type f \( -name '*.py' -or -executable \) -exec \
    sed -i -e "s|#![ ]*/usr/bin/python$|#!/usr/bin/python2|" \
           -e "s|#![ ]*/usr/bin/env python$|#!/usr/bin/env python2|" \
           \{\} + 
}

package() {
  cd "$srcdir/$pkgname-$pkgver"
  python2 setup.py install --root="$pkgdir/" --optimize=1

  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

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