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

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

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

  export SETUPTOOLS_SCM_PRETEND_VERSION="${pkgver}"

  python -m build --wheel --skip-dependency-check --no-isolation
}

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

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

  install -Dm644 LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.txt"
}
