desktop/python-requests/PKGBUILD

64 lines
2.1 KiB
Bash
Raw Permalink Normal View History

# Maintainer: UtG <utg[dot]chakra.linux[at]gmail[dot]com>
pkgbase=python-requests
pkgname=(python2-requests python3-requests)
2017-11-01 06:04:26 +08:00
pkgver=2.18.4
2017-11-07 04:09:32 +08:00
pkgrel=2
_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'
2017-11-07 04:09:32 +08:00
'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')
2014-09-07 02:06:09 +08:00
license=('Apache')
arch=('any')
2017-11-01 06:04:26 +08:00
source=("$pkgbase-$pkgver.tar.gz::https://github.com/kennethreitz/requests/archive/v$pkgver.tar.gz"
certs.patch)
2017-11-01 06:04:26 +08:00
sha256sums=('b068ccce3b739a29cbf72148b0ff4be3d80198fb7cdbd63066f7384bb56ef917'
'3fa0c8ef2018ef0987d2daff79765b99abd99c539f2ec1241bcf9c31b1a4fd75')
prepare() {
cd "$srcdir"/requests-$pkgver
2017-11-01 06:04:26 +08:00
sed -e '/certifi/d' \
-i setup.py
2017-11-01 06:04:26 +08:00
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
2017-11-07 04:09:32 +08:00
py.test tests
cd "$srcdir"/requests-$pkgver-py2
2017-11-07 04:09:32 +08:00
py.test2 tests
}
2014-09-07 02:06:09 +08:00
package_python3-requests() {
2017-11-07 04:09:32 +08:00
depends=('python3-urllib3' 'python3-chardet' 'python3-idna')
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() {
2017-11-07 04:09:32 +08:00
depends=('python2-urllib3' 'python2-chardet' 'python2-idna')
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"
}