aboutsummaryrefslogtreecommitdiffstats
path: root/main/py-nose/APKBUILD
blob: 7de0a07f061c7c45fd793607f0c9b66d15c14b07 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer:
pkgname=py-nose
_pkgname=nose
pkgver=1.3.7
pkgrel=2
pkgdesc="A Python unittest module"
url="http://readthedocs.org/docs/nose/"
arch="noarch"
license="LGPL-2.0-or-later"
makedepends="python2-dev python3-dev py-setuptools"
subpackages="$pkgname-doc py2-$_pkgname:_py2 py3-$_pkgname:_py3"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz
	coverage4-compat.patch
	python3.5-compat.patch
	fix-crashing-from-UnicodeDecodeError.patch
	fix-doctests-unicode.patch
	python3.6-compat.patch"
builddir="$srcdir/$_pkgname-$pkgver"

prepare() {
	default_prepare

	cd "$builddir"/examples
	cat attrib_plugin.py | tr -d '\r' > attrib_plugin.py.fixed
	mv attrib_plugin.py.fixed attrib_plugin.py

	# Soure files are modified during build with 2to3 tool, so we cannot
	# build it for both Python versions in the same location.
	local python; for python in python2 python3; do
		cp -r "$builddir" "$builddir-$python"
	done
}

build() {
	local python; for python in python2 python3; do
		cd "$builddir"-$python
		$python setup.py build
	done
}

check() {
	msg "Testing on python2"
	cd "$builddir-python2"
	python2 selftest.py

	msg "Testing on python3"
	cd "$builddir-python3"
	(
		export PYTHONPATH="$(pwd)/build/lib"
		python3 setup.py build_tests
		python3 selftest.py
	)
}

package() {
	cd "$builddir"
	install -D -m 644 nosetests.1 "$pkgdir"/usr/share/man/man1/nosetests.1
}

_py2() {
	replaces="$pkgname"
	_py python2
	rm "$subpkgdir"/usr/bin/nosetests
}

_py3() {
	_py python3
}

_py() {
	local python="$1"
	pkgdesc="$pkgdesc (for $python)"
	depends="$python"
	install_if="$pkgname=$pkgver-r$pkgrel $python"

	cd "$builddir"-$python

	$python setup.py install --prefix=/usr --root="$subpkgdir"
	rm -rf "$subpkgdir"/usr/man
}

sha512sums="e65c914f621f8da06b9ab11a0ff2763d6e29b82ce2aaed56da0e3773dc899d9deb1f20015789d44c65a5dad7214520f5b659b3f8d7695fb207ad3f78e5cf1b62  nose-1.3.7.tar.gz
90238837b7d67a425c816e2160641aa55b8b0193d8b86c46efdd3d15b2d73880c8d6ad658bac40216bc9d8104de491bcec629cf7bfcf9f7a2022b7deec668f39  coverage4-compat.patch
68693cda7a9d5787f56a26bd98949817e67d8795c324c968cb8af599e1e5f190531f80fc71de1233b88918f21f558f4d81f92dde529f908a0a66e5dd80b7ec21  python3.5-compat.patch
741b97c6f8e33a8a712bb9db148cf869189065d0ea0c07b361356470b370a78e5075e6f631eb7fc714ace29c6904ee0324494b86cfe3414a6bb97193b5d77e52  fix-crashing-from-UnicodeDecodeError.patch
bcc01fb8283ea097739db5d52be6c1835cbc6f8a14a235f921d1b2b1d70ac0d91a039781e40dba55d5b5380aa963409223cf79a636fce756fe100a37e500503b  fix-doctests-unicode.patch
9c47a73a16766e77d086c1a0bb1cc59064eb5755c0d46bfd1814b1aa90dc90c672dda03547abff389f5a05633eff7a3991e41c5e61c12cf51080a08a71f79199  python3.6-compat.patch"