aboutsummaryrefslogtreecommitdiffstats
path: root/community/py3-flake8/APKBUILD
blob: 866f13e8c8989df9cdf5e132a4d9cf4d384527a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Contributor: Peter Bui <pnutzh4x0r@gmail.com>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
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"