aboutsummaryrefslogtreecommitdiffstats
path: root/testing/py-django-cors-headers/APKBUILD
blob: 4570865544b729d7ee0d7ed5d2a95851915e17cb (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-cors-headers
pkgver=2.4.0
pkgrel=1
pkgdesc="Django app for handling the server headers required for Cross-Origin Resource Sharing (CORS)"
url="https://github.com/OttoYiu/django-cors-headers"
arch="noarch"
license="Custom"
depends="py-django"
makedepends="python2-dev python3-dev py-setuptools"
checkdepends="py-django py-tz py-mock pytest"
subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3"
options="!check" # FIXME: fail
source="$pkgname-$pkgver.tar.gz::https://github.com/ottoyiu/django-cors-headers/archive/$pkgver.tar.gz"
builddir="$srcdir"/django-cors-headers-$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 ./tests
	python3 runtests.py ./tests
}

_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="97f12655b0f499e62fbee6b506703fe9a43988f5d5ab275eb16ce8429c221fab6f8c50670357b33f218686490ae1a54527743a32d3a796c333dcb6328db4b94e  py-django-cors-headers-2.4.0.tar.gz"