# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: eolianoe <eolianoe At GoogleMAIL DoT com>

pkgname=python-requests-toolbelt
pkgver=1.0.0
pkgrel=6
pkgdesc='A toolbelt of useful classes and functions to be used with python-requests'
arch=(any)
url='https://github.com/requests/toolbelt'
license=(Apache-2.0)
depends=(
  python
  python-requests
)
makedepends=(
  git
  python-build
  python-installer
  python-setuptools
  python-wheel
)
checkdepends=(
  python-pytest
  python-betamax
  python-ndg-httpsclient
  python-pyopenssl
  python-trustme
)
source=("$pkgname::git+$url#tag=$pkgver")
sha512sums=('083e547bec0cfccb56d37ff9298dba1213db3fe39074e75b9aedde32001601762fa8f0446574144bc993ced4517c13e158efd92840d1e1c1b8e26cf16929c0aa')
b2sums=('bd1e808a938094e9c45ef438526e5096fc7f31a06f1a2b1da3b3286b84cfd2bc684d55a49e48313e3d5e77cd6474b005cfb70c62b33d383b4d3466cd7d91f7d7')

prepare() {
  cd "$pkgname"

  # urlib3 2.0 compatibility
  git cherry-pick --no-commit \
    090856f4159c40a2927fb88546419f2e1697ad5f \
    720240501dca0b4eacc3295665d7ced8719e11d2
}

build() {
  cd "$pkgname"

  python -m build --wheel --no-isolation
}

check() {
  cd "$pkgname"

  pytest -v
}

package() {
  cd "$pkgname"

  python -m installer --destdir="$pkgdir" dist/*.whl
}
