# Contributor: Peter Bui # Maintainer: Fabian Affolter pkgname=py-flake8 _pkgname=${pkgname#py-} pkgver=3.7.7 pkgrel=1 pkgdesc="A modular source code checker" url="https://gitlab.com/pycqa/flake8" arch="noarch" license="MIT" _py2_extra_depends="py-enum34 py2-typing py2-configparser py2-functools32" _common_depends="py-entrypoints py-pyflakes py-pycodestyle py-mccabe py-setuptools" makedepends="python2 python3 ${_common_depends} ${_py2_extra_depends}" checkdepends="pytest py-pbr py-atomicwrites py-attrs py-pluggy py-six py-mock" subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3" source="https://pypi.io/packages/source/f/$_pkgname/$_pkgname-$pkgver.tar.gz" builddir="$srcdir/$_pkgname-$pkgver" build() { cd "$builddir" python2 setup.py build python3 setup.py build } check() { cd "$builddir" python2 setup.py test python3 setup.py test } package() { depends="py3-flake8" mkdir -p "$pkgdir"/usr/bin ln -s flake8-3 "$pkgdir"/usr/bin/flake8 } _py2() { replaces=flake8 provides="flake8=$pkgver-r$pkgrel" depends="${_common_depends//py-/py2-} ${_py2_extra_depends}" _py python2 } _py3() { depends="${_common_depends//py-/py3-}" _py python3 } _py() { local python="$1" local pyver="${1#python}" pkgdesc="$pkgdesc (for $python)" depends="$depends $python" install_if="$pkgname=$pkgver-r$pkgrel $python" cd "$builddir" $python setup.py install --prefix=/usr --root="$subpkgdir" # Add version suffix to executable files. local path; for path in "$subpkgdir"/usr/bin/*; do mv "$path" "$path-$pyver" done } sha512sums="45a1d6d0ff84bc79738853930f14c2aa423cb7ac68b1655887ac9f68efdcce3d49d13f01cfa86ac82b759bbfe2b1182006c51b612b9230882aa03932100b5511 flake8-3.7.7.tar.gz"