# Maintainer: UtG pkgbase=python-requests pkgname=(python2-requests python3-requests) pkgver=2.18.4 pkgrel=2 _libname=requests pkgdesc="Requests is an Apache2 Licensed HTTP library, written in Python, for human beings." url="http://python-requests.org/" makedepends=('python2-setuptools' 'python3-setuptools' 'python3-chardet' 'python2-chardet' 'python3-urllib3' 'python2-urllib3' 'python3-idna' 'python2-idna') checkdepends=('python3-pytest-httpbin' 'python2-pytest-httpbin' 'python3-pysocks' 'python2-pysocks' 'python3-pytest-mock' 'python2-pytest-mock') license=('Apache') arch=('any') source=("$pkgbase-$pkgver.tar.gz::https://github.com/kennethreitz/requests/archive/v$pkgver.tar.gz" certs.patch) sha256sums=('b068ccce3b739a29cbf72148b0ff4be3d80198fb7cdbd63066f7384bb56ef917' '3fa0c8ef2018ef0987d2daff79765b99abd99c539f2ec1241bcf9c31b1a4fd75') prepare() { cd "$srcdir"/requests-$pkgver sed -e '/certifi/d' \ -i setup.py patch -p1 -i "$srcdir"/certs.patch cd "$srcdir" cp -a requests-$pkgver{,-py2} find requests-$pkgver -name \*.py -exec sed -r 's|^#!(.*)python$|#!\1python3|' -i {} + find requests-$pkgver-py2 -name \*.py -exec sed -r 's|^#!(.*)python$|#!\1python2|' -i {} + } build() { cd "$srcdir"/requests-$pkgver python3 setup.py build cd "$srcdir"/requests-$pkgver-py2 python2 setup.py build } check() { cd "$srcdir"/requests-$pkgver py.test tests cd "$srcdir"/requests-$pkgver-py2 py.test2 tests } package_python3-requests() { depends=('python3-urllib3' 'python3-chardet' 'python3-idna') cd "$srcdir"/requests-$pkgver python3 setup.py install --skip-build -O1 --root="$pkgdir" install -m0644 -D "LICENSE" "$pkgdir"/usr/share/licenses/$pkgname/LICENSE } package_python2-requests() { depends=('python2-urllib3' 'python2-chardet' 'python2-idna') optdepends=('python2-ndg-httpsclient: HTTPS requests with SNI support' 'python2-grequests: asynchronous requests with gevent') cd "$srcdir"/requests-$pkgver-py2 python2 setup.py install --skip-build -O1 --root="$pkgdir" }