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

pkgname=usort
pkgver=1.0.8
pkgrel=1
pkgdesc='Safe, minimal import sorting for Python projects'
arch=('any')
url='https://github.com/facebookexperimental/usort'
license=('MIT')
depends=('python-attrs' 'python-click' 'python-libcst' 'python-moreorless'
         'python-stdlibs' 'python-toml' 'python-trailrunner')
makedepends=('python-build' 'python-installer' 'python-setuptools-scm' 'python-wheel')
checkdepends=('python-volatile')
source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
sha512sums=('d6f35df433cc23481a97bbd8026d68785f8db4d6e8e1a1e039ca962d0a5e586a370417b37ed53c0e1713ceae0713d84ddd63ac26e38f4a6f46802f4b3dcdfc4e')

build() {
  cd $pkgname-$pkgver

  SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver python -m build -nw
}

check() {
  cd $pkgname-$pkgver

  python -m usort.tests
}

package() {
  cd $pkgname-$pkgver

  python -m installer -d "$pkgdir" dist/*.whl

  install -Dm 644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

# vim:set ts=2 sw=2 et:
