aboutsummaryrefslogtreecommitdiffstats
path: root/main/py-flake8/APKBUILD
blob: 5aaad995866a90520781ee697ebaaacb348bdd6a (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
# Contributor: Peter Bui <pnutzh4x0r@gmail.com>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py-flake8
_pkgname=${pkgname#py-}
pkgver=3.4.1
pkgrel=2
pkgdesc="A modular source code checker"
url="https://gitlab.com/pycqa/flake8"
arch="noarch"
license="MIT"
depends="py-mccabe py-pep8 py-pyflakes"
makedepends="python2-dev python3-dev py-setuptools"
subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3"
options="!check"  # no testsuite
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
}

package() {
	cd "$builddir"

	mkdir -p "$pkgdir"/usr/bin
	ln -s flake8-3 "$pkgdir"/usr/bin/flake8
}

_py2() {
	replaces=flake8
	provides="flake8=$pkgver-r$pkgrel"
	depends="${depends//py-/py2-}"
	_py python2
}

_py3() {
	depends="${depends//py-/py3-}"
	_py python3
}

_py() {
	local python="$1"
	local pyver="${1:6:1}"
	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="42df8fa0cf6f4bb4f3e52143028dee14d51a645aef19a0bab05000fef577e5bea3cc29f961acb0c98d92b76e635fdd2f0d689e23663a6c14d435d0410be94c87  flake8-3.4.1.tar.gz"