# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Daniel M. Capella <polyzen@archlinux.org>
# Contributor: Ismael Carnales <icarnales at gmail dot com>
# Contributor: Sergey Mastykov <smastykov[at]gmail[dot]com>

pkgname=python-pycodestyle
pkgver=2.14.0
pkgrel=1
pkgdesc="Python style guide checker"
arch=('any')
url="https://pycodestyle.pycqa.org"
license=('custom:Expat')
depends=('python')
makedepends=(
  'python-build'
  'python-installer'
  'python-setuptools'
  'python-wheel'
)
checkdepends=('python-pytest')
source=("https://github.com/PyCQA/pycodestyle/archive/$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('0c81febffaf0f23ff4a8f7168202a05917aef913bdd92f0a45b1d595272b8206e79987c43eefbdc850b94a467f25f43067209320b60be628d46788c3cc1ad618')

build() {
  cd pycodestyle-$pkgver
  python -m build --wheel --skip-dependency-check --no-isolation
}

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

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

  # Symlink license file
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  install -d "$pkgdir"/usr/share/licenses/$pkgname
  ln -s "$site_packages"/pycodestyle-$pkgver.dist-info/LICENSE \
    "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

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