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

_name=flit
pkgname=python-flit
pkgver=4.0.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=('1de9358fa33d0924355679ab6bccf5933f2f154257a875dfec7bf88bb569fce487129ff2d7ea13df16287acaedf9da49ce5f9baccd160ebfb6fd33e831e9c9cb')
b2sums=('f60a29e5779236175ff5792745b8e2d1333e3ef8ccec639634d5b31cdc8c5811908a98c420bf0e5eeb488260287532a506f5b24dd6b95e6c328fe0220088a9e0')

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