desktop/python-requests/PKGBUILD
AlmAck 08a66c4024 python3 rebuild for 3.5
new pkg added to fullfill checkdepends
new order file python3.order
2016-03-16 22:36:13 +01:00

73 lines
2.3 KiB
Bash

# Maintainer: UtG <utg[dot]chakra.linux[at]gmail[dot]com>
pkgbase=python-requests
pkgname=(python2-requests python3-requests)
pkgver=2.9.1
pkgrel=1
_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')
checkdepends=('python3-pytest-httpbin' 'python2-pytest-httpbin')
license=('Apache')
arch=('any')
source=(http://pypi.python.org/packages/source/${_libname:0:1}/$_libname/$_libname-$pkgver.tar.gz
certs.patch)
sha256sums=('c577815dd00f1394203fc44eb979724b098f88264a9ef898ee45b8e5e9cf587f'
'e35e779d8640f35ea2ea51112f967d927b44d59483af4cd2c0945c84e79bb7c7')
prepare() {
cd "$srcdir"/requests-$pkgver
patch -p1 -i "$srcdir"/certs.patch
sed -r 's#(\W|^)requests/cacert\.pem(\W|$)##' -i MANIFEST.in
rm -f requests/cacert.pem
rm -r requests/packages/{urllib3,chardet}
sed -e '/packages.chardet/d' \
-e '/packages.urllib3/d' \
-i setup.py
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
test -f "$(python3 -m requests.certs)"
py.test
cd "$srcdir"/requests-$pkgver-py2
test -f "$(python2 -m requests.certs)"
py.test2
}
package_python3-requests() {
depends=('python3-urllib3' 'python3-chardet')
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')
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"
}