# Maintainer: Natanael Copa pkgname=python pkgver=2.7.10 _verbase=${pkgver%.*} pkgrel=2 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 linux-headers paxmark" source="http://www.$pkgname.org/ftp/$pkgname/$pkgver/Python-$pkgver.tar.xz musl-find_library.patch unchecked-ioctl.patch" 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 # Make sure we use system libs rm -r Modules/expat Modules/_ctypes/libffi* Modules/zlib || return 1 # make sure our /dev/shm is world writeable if ! touch /dev/shm/$pkgname-$pkgver; then error "/dev/shm is not world writeable. this will cause a broken python build" return 1 fi rm /dev/shm/$pkgname-$pkgver } build() { cd "$srcdir/Python-$pkgver" export OPT="$CFLAGS" ./configure \ --build=$CBUILD \ --host=$CHOST \ --prefix=/usr \ --enable-shared \ --with-threads \ --enable-ipv6 \ --with-system-ffi \ --with-system-expat \ --with-system-zlib \ --enable-unicode=ucs4 \ || return 1 make || return 1 } package() { cd "$srcdir/Python-$pkgver" make -j1 DESTDIR="$pkgdir" install || return 1 install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE rm "$pkgdir/usr/bin/2to3" || return 1 # we need to enable emutramp - needed for virt-manager # disable mprotect - needed for cffi paxmark -zm "$pkgdir"/usr/bin/python$_verbase || 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="c685ef0b8e9f27b5e3db5db12b268ac6 Python-2.7.10.tar.xz 23691939c584e8490948b4331927e4bc musl-find_library.patch dada786a50fa332686a9b9260d84c110 unchecked-ioctl.patch" sha256sums="1cd3730781b91caf0fa1c4d472dc29274186480161a150294c42ce9b5c5effc0 Python-2.7.10.tar.xz efb0e5312422494be03cfb89b52404d66796e3fd3c6ccb49b32917294d66d93e musl-find_library.patch f9d37609bab83d9ffff96ec9a33e16568cfb14980d389f7fe34a1c837397e359 unchecked-ioctl.patch" sha512sums="67615a6defbcda062f15a09f9dd3b9441afd01a8cc3255e5bc45b925378a0ddc38d468b7701176f6cc153ec52a4f21671b433780d9bde343aa9b9c1b2ae29feb Python-2.7.10.tar.xz 382e86e53f9d87c3e6b36c56f8296eab2f24a20ba1fb0a1fdcbe40f6bbb51c93ab03403499f7c9f6a33430eb69b81fc613d430a37880bde9fbe510503c409529 musl-find_library.patch 5a8e013a4132d71c4360771f130d27b37275ae59330cf9a75378dc8a11236017f540eb224f2a148984e82ca3fb6b29129375b1080ba05b81044faa717520ab82 unchecked-ioctl.patch"