# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Eli Schwartz <eschwartz@archlinux.org>

pkgname=python-distlib
pkgver=0.3.8
pkgrel=1
pkgdesc='Low-level functions that relate to packaging and distribution of Python software'
arch=('any')
url='https://distlib.readthedocs.io'
license=('PSF')
depends=('python')
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-setuptools'
  'python-wheel'
)
_commit='ab5f8e797fbc56a0e3488bba68d05e7a602cb63f'
source=("$pkgname::git+https://github.com/vsajip/distlib#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd "$pkgname"

  git describe --tags | sed 's/^v//'
}

prepare() {
  cd "$pkgname"

  # do not bundle executables of unknown provenance
  rm distlib/*.exe
}

build() {
  cd "$pkgname"

  python -m build --wheel --no-isolation
}

check() {
  cd "$pkgname"

  python tests/test_all.py
}

package() {
  cd "$pkgname"

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