# Contributor: Peter Bui <pnutzh4x0r@gmail.com>
# Maintainer: William Pitcock <nenolod@dereferenced.org>
pkgname=py-requests
_pkgname=requests
pkgver=2.18.4
pkgrel=0
pkgdesc="A HTTP request library for Python"
url="http://www.python-requests.org/"
arch="noarch"
license="Apache-2.0"
# Requirements for tests are not available in main
options="!check"
depends="py-chardet py-idna py-certifi py-urllib3"
makedepends="python2-dev py-setuptools python3-dev"
subpackages="py3-${pkgname#py-}:_py3 py2-${pkgname#py-}:_py2"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	cd "$builddir"
	python2 setup.py build
	python3 setup.py build
}

package() {
	mkdir -p "$pkgdir"
}

_py() {
	local python="$1"
	pkgdesc="$pkgdesc ${python#python}"
	depends="$depends $python"
	install_if="$pkgname=$pkgver-r$pkgrel $python"

	cd "$builddir"
	$python setup.py install --prefix=/usr --root="$subpkgdir"
}

_py2() {
	replaces="$pkgname"
	depends="${depends//py-/py2-}"
	_py python2
}

_py3() {
	depends="${depends//py-/py3-}"
	_py python3
}

sha512sums="5c59bed82ac1094194f04a973b299f7d783264d372abd7a5229295bccc6b2f7a9f082ee4b0dff348e9c22cf68ddbd7cb67f60fd0b7d9eda41c02e40d075e9472  requests-2.18.4.tar.gz"
