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

_realname=urllib3
pkgname="python-${_realname}"
pkgver=2.6.2
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=('0d25e451e03d28a1a0df8c7bef9ab59adb5657d000f7293f044b88428a0acab6')

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
}
