# Maintainer: Christoph Reiter <reiter.christoph@gmail.com>

_realname=installer
pkgname="python-${_realname}"
pkgver=0.7.0
pkgrel=2
pkgdesc="A low-level library for installing from a Python wheel distribution"
arch=('any')
url='https://github.com/pypa/installer'
msys2_references=(
  "purl: pkg:pypi/installer"
)
license=('spdx:MIT')
depends=("python")
makedepends=(
  "python-flit-core"
)
source=("${_realname}-$pkgver.tar.gz"::"https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('a26d3e3116289bb08216e0d0f7d925fcef0b0194eedfa0c944bcaaa106c4b631')

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

  python -m flit_core.wheel
}

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

  PYTHONPATH="${srcdir}/${_realname}-${pkgver}/src" \
    python -m installer --destdir="${pkgdir}" dist/*.whl

  # remove windows entrypoint scripts executables
  rm "$pkgdir"/usr/lib/python*/site-packages/installer/_scripts/*.exe
}
