desktop/python-requests/PKGBUILD

73 lines
2.3 KiB
Bash
Raw Normal View History

# 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
2013-03-02 08:24:36 +08:00
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')
2014-09-07 02:06:09 +08:00
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
2014-09-07 02:06:09 +08:00
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
2014-09-07 02:06:09 +08:00
test -f "$(python3 -m requests.certs)"
py.test
cd "$srcdir"/requests-$pkgver-py2
test -f "$(python2 -m requests.certs)"
py.test2
}
2014-09-07 02:06:09 +08:00
package_python3-requests() {
depends=('python3-urllib3' 'python3-chardet')
cd "$srcdir"/requests-$pkgver
2014-09-07 02:06:09 +08:00
python3 setup.py install --skip-build -O1 --root="$pkgdir"
install -m0644 -D "LICENSE" "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
2014-09-07 02:06:09 +08:00
package_python2-requests() {
depends=('python2-urllib3' 'python2-chardet')
2014-09-07 02:06:09 +08:00
optdepends=('python2-ndg-httpsclient: HTTPS requests with SNI support'
'python2-grequests: asynchronous requests with gevent')
cd "$srcdir"/requests-$pkgver-py2
2014-09-07 02:06:09 +08:00
python2 setup.py install --skip-build -O1 --root="$pkgdir"
}