# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>

pkgname=python-requests
pkgver=2.31.0
pkgrel=1
pkgdesc="Python HTTP for Humans"
arch=('any')
url="https://requests.readthedocs.io/"
license=('Apache')
depends=('python-charset-normalizer' 'python-idna' 'python-urllib3')
makedepends=(python-build python-installer python-setuptools python-wheel)
checkdepends=(
  'python-pysocks'
  'python-pytest-httpbin'
  'python-pytest-mock'
  'python-trustme'
)
optdepends=(
  'python-chardet: alternative character encoding library'
  'python-pysocks: SOCKS proxy support'
)
source=(
  "https://github.com/psf/requests/archive/v$pkgver/$pkgname-$pkgver.tar.gz"
  certs.patch
)
sha512sums=('43f536bdb2360fcceb24ef98e995ffa66cdefc2c502629f17a5722445bfa9ad8489201958c846c2aaef37e427f95a4d56e321a91095c69754680abfd83b39150'
            '424a3bb01b23409284f6c9cd2bc22d92df31b85cfd96e1d1b16b5d68adeca670dfed4fff7977d8b10980102b0f780eacc465431021fcd661f3a17168a02a39a3')

prepare() {
  cd requests-$pkgver
  sed -i '/certifi/d' setup.py
  patch -p1 -i ../certs.patch
}

build() {
  cd requests-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd requests-$pkgver
  pytest tests
}

package() {
  cd requests-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
}

# vim: ts=2 sw=2 et:
