# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=urllib3
pkgname="python-${_realname}"
pkgver=2.5.0
pkgrel=1
pkgdesc="HTTP library with thread-safe connection pooling and file post support"
url='https://github.com/urllib3/urllib3'
msys2_references=(
  "anitya: 4078"
  "purl: pkg:pypi/urllib3"
  "cpe: cpe:/a:python:urllib3"
)
license=('spdx:MIT')
arch=('any')
depends=("python")
makedepends=(
  "python-hatchling"
  "python-hatch-vcs"
  "python-build"
  "python-installer"
)
source=("${_realname}-${pkgver}.tar.gz::https://github.com/urllib3/urllib3/archive/${pkgver}.tar.gz")
sha256sums=('5ea3e7c3e387e65abe94af551c39c7a207d6bcec7053ae3d2dd643073dffb64b')

build() {
  cd "${srcdir}/${_realname}-${pkgver}"

  export SETUPTOOLS_SCM_PRETEND_VERSION=${pkgver}
  python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"

  python -m installer --destdir="${pkgdir}" dist/*.whl
  install -D -m644 LICENSE.txt "${pkgdir}"/usr/share/licenses/python-${_realname}/LICENSE.txt
}
