aboutsummaryrefslogtreecommitdiffstats
path: root/main/pytest/APKBUILD
blob: 6cedd4d2013ae77b3e010abf08df4989788feaea (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: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=pytest
pkgver=3.7.4
pkgrel=1
pkgdesc="A python test library"
url="http://pytest.org"
arch="noarch"
license="MIT"
depends="py3-$pkgname"
_py_depends="py-atomicwrites py-py py-six py-attrs py-more-itertools py-pluggy"
_py2_depends="${_py_depends//py-/py2-} py2-setuptools py2-funcsigs py2-pathlib2"
_py3_depends="${_py_depends//py-/py3-} py3-setuptools"
makedepends="python2-dev py-setuptools python3-dev $_py2_depends $_py3_depends"
subpackages="py3-$pkgname:_py3 py2-$pkgname:_py2"
source="https://files.pythonhosted.org/packages/source/${pkgname:0:1}/$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 check
	python3 setup.py check
}

package() {
	mkdir -p "$pkgdir"/usr/bin

	local name; for name in py.test pytest; do
		ln -s $name-3 "$pkgdir"/usr/bin/$name
	done
}

_py2() {
	replaces="$pkgname"
	depends="$_py2_depends"
	_py python2
}

_py3() {
	depends="$_py3_depends"
	_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="b62419ebcc64b470d429f093c2434ca842f7171164e3f5a37bb0cc8f5da04fa52f096710f167d15a77df128a0f6f79f16e4f4f00ffa22b26111ecfe8d00f0c50  pytest-3.7.4.tar.gz"