# Maintainer: atom2013 <atom.long@hotmail.com>

_realname=pip
pkgbase="python-${_realname}"
pkgname=("python-${_realname}")
pkgver=25.2
pkgrel=1
pkgdesc="The PyPA recommended tool for installing Python packages"
url="https://pip.pypa.io/"
msys2_repository_url="https://github.com/pypa/pip"
msys2_references=(
  "purl: pkg:pypi/pip"
  "cpe: cpe:/a:pypa:pip"
)
arch=('any')
license=('spdx:MIT')
depends=(
  'python'
)
makedepends=(
  'python-build'
  'python-installer'
  'python-setuptools'
)
provides=("python3-${_realname}")
replaces=("python3-${_realname}")
conflicts=("python3-${_realname}")
source=(${_realname}-${pkgver}.tar.gz::https://github.com/pypa/${_realname}/archive/${pkgver}.tar.gz)
sha256sums=('d09e469f9c6d829eb5094f8369912519c025868a772077e826afd161abd67aee')

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

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

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

  python -m installer --destdir="${pkgdir}" dist/*.whl
  rm "${pkgdir}"/usr/lib/python*/site-packages/pip/_vendor/distlib/*.exe

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