# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>
# Contributor: Eli Schwartz <eschwartz@archlinux.org>

_name=flit
pkgname=python-flit
pkgver=3.12.0
pkgrel=1
pkgdesc='Simplified packaging of Python modules'
arch=('any')
url='https://github.com/pypa/flit'
license=('BSD')
depends=('python' 'python-docutils' 'python-flit-core' 'python-requests' 'python-tomli-w')
makedepends=('python-build' 'python-installer')
checkdepends=('python-pip' 'python-pytest' 'python-responses' 'python-testpath')
source=("$pkgname-$pkgver.tar.gz::$url/archive/$pkgver.tar.gz")
sha512sums=('ff6df66dfdae6fdf7b277cc3fbb7c9a569103cbe82a3e3ce6f315ec6adec46be8692eba4549a66b3af537d128e6b57ed8f49316b705636466c25674198503643')
b2sums=('b7e97a8665aeac90d81b033450cec7e3d1f6661916e3f5f7443025723047291b3482414d3189cafa56df859a3a4ba8f868526ec39db7888b55f24a12529ececf')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd $_name-$pkgver
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  test-env/bin/python -m pytest -vv
}

package_python-flit() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
}
