summaryrefslogtreecommitdiffstats
path: root/main/python/APKBUILD
blob: 95b241da9bdd93d43dd56866d2408cf42cb0b56c (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=python
pkgver=2.7.2
_verbase=${pkgver%.*}
pkgrel=3
pkgdesc="A high-level scripting language"
url="http://www.python.org"
arch="all"
license="custom"
replaces="python-dev"
subpackages="$pkgname-dev $pkgname-doc $pkgname-tests
	py-gdbm:gdbm
	"
depends=
makedepends="expat-dev openssl-dev zlib-dev ncurses-dev bzip2-dev
	gdbm-dev sqlite-dev libffi-dev readline-dev"
source="http://www.$pkgname.org/ftp/$pkgname/$pkgver/Python-$pkgver.tar.bz2
	"

prepare() {
	cd "$srcdir/Python-$pkgver"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1
		esac
	done
}

build() {
	cd "$srcdir/Python-$pkgver"
	./configure --prefix=/usr \
		--enable-shared \
		--with-threads \
		--with-system-ffi \
		--with-system-expat \
		--enable-unicode=ucs4 \
		|| return 1

	make || return 1
}

package() {
	cd "$srcdir/Python-$pkgver"
	make -j1 DESTDIR="$pkgdir" install
	install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
	rm "$pkgdir/usr/bin/2to3" || return 1
}

_mv_files() {
	local i
	for i in "$@"; do
		mkdir -p "$subpkgdir"/${i%/*}
		mv "$pkgdir"/$i "$subpkgdir"/$i || return 1
	done
}

dev() {
	# pyconfig.h is needed runtime so we move it back
	default_dev
	mkdir -p "$pkgdir"/usr/include/python$_verbase
	mv "$subpkgdir"/usr/include/python$_verbase/pyconfig.h \
		"$pkgdir"/usr/include/python$_verbase/
}

tests() {
	pkgdesc="The test modules from the main python package"
	cd "$pkgdir"
	_mv_files usr/lib/python*/*/test \
		usr/lib/python*/test
}

gdbm() {
	pkgdesc="GNU dbm database support for Python"
	cd "$pkgdir"
	_mv_files $(find usr/lib -name '*gdbm*')
}

md5sums="ba7b2f11ffdbf195ee0d111b9455a5bd  Python-2.7.2.tar.bz2"