# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Daniel M. Capella <polyzen@archlinux.org>
# Contributor: Karol 'Kenji Takahashi' Woźniak <kenji.sx>
# Contributor: Tianjiao Yin <ytj000+AUR@gmail.com>
# Contributor: Thomas Dziedzic < gostrc at gmail >
# Contributor: TDY <tdy@gmx.com>
# Contributor: Tiago Pierezan Camargo <tcamargo@gmail.com>

pkgname=python-pyflakes
pkgver=3.2.0
pkgrel=2
pkgdesc='A lint-like tool for Python to identify common errors quickly without executing code'
arch=('any')
url='https://github.com/PyCQA/pyflakes'
license=('MIT')
depends=('python')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/$pkgver.tar.gz")
sha512sums=('90db46325b844bf4bdc5ae4073a7478a46ee93500c9b8cf43fb31a5f548710cce65e6e0790b72b52e6a31c46a45c2080da644d91198cb64f529cd8a413b6e24e')

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

check() {
  cd pyflakes-$pkgver
  python -m unittest discover pyflakes
}

package() {
  cd pyflakes-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl

  # We have python 3 as default python, and want to keep compatibility with the old pyflakes3k naming
  ln -s pyflakes "$pkgdir/usr/bin/pyflakes3k"

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