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

_name=flit
pkgname=python-flit
pkgver=3.9.0
pkgrel=2
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=('1218756afcb79af1df0020548102ba29245a9fa998d332357a2a6a2b7b543dda835918f4811ba343e86e1f7c6b45a6dcafe26f8e905c1e49734141f7d4e9f4fc')
b2sums=('bae3baf324016e25f8422a79c60b91c3a6f3422ca57b20c3585444c912dfaca23b73e147912d503b9b78f69bbb7db861ab926b29ff081c5c75ada155e914c4a3')

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/"
}
