aboutsummaryrefslogtreecommitdiffstats
path: root/testing/py-django-rest-framework/APKBUILD
blob: 64c3df3af2f6c6364a485d1d86372ad3bc82e244 (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
# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer:
pkgname=py-django-rest-framework
pkgver=3.7.3
pkgrel=0
pkgdesc="Web APIs for Django"
url="https://github.com/encode/django-rest-framework"
arch="noarch"
license="Custom"
depends="py-django"
makedepends="python2-dev python3-dev py2-setuptools"
checkdepends="pytest py-tz py-core-api py-jinja2 py-uritemplate"
subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3"
options="!check" # fails with "OperationalError: no such table: tests_blog"
source="$pkgname-$pkgver.tar.gz::https://github.com/encode/django-rest-framework/archive/$pkgver.tar.gz"
builddir="$srcdir"/django-rest-framework-$pkgver

build() {
	cd "$builddir"
	python2 setup.py --quiet build
	python3 setup.py --quiet build
}

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

check() {
	cd "$builddir"
	python2 runtests.py
	python3 runtests.py
}

_py2() {
	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 --quiet install --prefix=/usr --root="$subpkgdir"
}

sha512sums="a134d4ce8911530c1bffd7c8e5336100186df5fb8e5e06cc30b872c212a3012e259c85b44e7ea3294f3a80c00f8cb358e1d352f7b4fa0c69d7874e8afb05be7b  py-django-rest-framework-3.7.3.tar.gz"