desktop/python-requests/PKGBUILD

63 lines
1.7 KiB
Bash

# Maintainer: UtG <utg[dot]chakra.linux[at]gmail[dot]com>
pkgbase=python-requests
pkgname=(python2-requests python3-requests)
pkgver=2.2.1
pkgrel=1
_libname=requests
pkgdesc="Requests is an Apache2 Licensed HTTP library, written in Python, for human beings."
arch=('x86_64')
url="http://python-requests.org/"
license=('Apache')
makedepends=('python2-setuptools' 'python3-setuptools')
source=(
"http://pypi.python.org/packages/source/${_libname:0:1}/$_libname/$_libname-$pkgver.tar.gz"
certs.patch)
md5sums=('ac27081135f58d1a43e4fb38258d6f4e'
'06377a41a785f0919d00b2a3e0fcd60e')
prepare() {
cd "$srcdir/$_libname-$pkgver"
patch -p0 -i "$srcdir/certs.patch"
sed -r 's#(\W|^)requests/cacert\.pem(\W|$)##' -i MANIFEST.in
rm -f requests/cacert.pem
}
build() {
msg2 "Starting the Python 3.x build"
cd "$srcdir/$_libname-$pkgver"
rm -rf ../buildpy3; mkdir ../buildpy3
python3 setup.py build -b ../buildpy3
find ../buildpy3 -name \*.py -exec sed -r 's|^#!(.*)python$|#!\1python3|' -i {} +
msg2 "Starting the Python 2.x build"
rm -rf ../buildpy2; mkdir ../buildpy2
python2 setup.py build -b ../buildpy2
find ../buildpy2 -name \*.py -exec sed -r 's|^#!(.*)python$|#!\1python2|' -i {} +
}
check() {
cd "$srcdir/$_libname-$pkgver"
test -f "$(python -m requests.certs)"
}
package_python2-requests() {
depends=('python2')
cd "$srcdir/$_libname-$pkgver"
rm -rf build; ln -s ../buildpy2 build
python2 setup.py install --skip-build -O1 --root="$pkgdir"
}
package_python3-requests() {
depends=('python3')
cd "$srcdir/$_libname-$pkgver"
rm -rf build; ln -s ../buildpy3 build
python3 setup.py install --skip-build -O1 --root="$pkgdir"
install -m0644 -D "LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}