aboutsummaryrefslogtreecommitdiffstats
path: root/main/py-django/APKBUILD
blob: 6c0a59bc05d1115e4eaf81e8e7de9b269e868b7a (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
# Contributor: Andrew Wilcox <AWilcox@Wilcox-Tech.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=py-django
_pkgname=Django
pkgver=1.11.15
pkgrel=0
pkgdesc="A high-level Python Web framework"
url="http://djangoproject.com/"
arch="noarch"
license="BSD"
depends="py-tz"
makedepends="python2-dev python3-dev py-setuptools"
options="!check" # some depends missing, others in community/testing
subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

# secfixes:
#   1.8.16-r0:
#     - CVE-2016-9013
#     - CVE-2016-9014
#   1.10.7-r0:
#     - CVE-2017-7233
#     - CVE-2017-7234
#   1.11.5-r0:
#     - CVE-2017-12794
#   1.11.10-r0:
#     - CVE-2018-6188
#   1.11.11-r0:
#     - CVE-2018-7536
#     - CVE-2018-7537
#   1.11.15-r0:
#     - CVE-2018-14574

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

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

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

	# Create unsuffixed symlinks for executables from py3 subpackage.
	local name; for name in django-admin; do
		ln -s $name-3 "$pkgdir"/usr/bin/$name
	done
}

_py2() {
	replaces="$pkgname"
	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"
	# Add version suffix to executable files.
	local path; for path in "$subpkgdir"/usr/bin/*.py; do
		mv -f "$path" "${path%%.py}"
		mv -f "${path%%.py}" "${path%%.py}-$pyver"
	done
}

sha512sums="4ea18c59f7c74d0b6deb9d292d5de068c6dcc53d9596f321f5a7e823ff5fe423cc8d69c88bf53e3acd9c36c4ecc4447148243a127d5114a4894b0fd4d449f37e  Django-1.11.15.tar.gz"