diff options
author | Bartłomiej Piotrowski <b@bpiotrowski.pl> | 2016-07-18 19:33:46 +0200 |
---|---|---|
committer | Bartłomiej Piotrowski <b@bpiotrowski.pl> | 2016-07-18 19:33:46 +0200 |
commit | 99dd043cd563c7919bb11bd2478a9e0f9a3dd1c0 (patch) | |
tree | 614346077236a57a7c83dab8dfb59d2bdc11474d /main/python2 | |
parent | 2c8afec95a601ac9e6ce0d39e761038970f8c0ec (diff) | |
download | aports-99dd043cd563c7919bb11bd2478a9e0f9a3dd1c0.tar.bz2 aports-99dd043cd563c7919bb11bd2478a9e0f9a3dd1c0.tar.xz |
main/python: rename to python2
Diffstat (limited to 'main/python2')
-rw-r--r-- | main/python2/APKBUILD | 101 | ||||
-rw-r--r-- | main/python2/musl-find_library.patch | 43 | ||||
-rw-r--r-- | main/python2/unchecked-ioctl.patch | 11 |
3 files changed, 155 insertions, 0 deletions
diff --git a/main/python2/APKBUILD b/main/python2/APKBUILD new file mode 100644 index 0000000000..2ef5515e3a --- /dev/null +++ b/main/python2/APKBUILD @@ -0,0 +1,101 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=python2 +pkgver=2.7.12 +_verbase=${pkgver%.*} +pkgrel=0 +pkgdesc="A high-level scripting language" +url="http://www.python.org" +arch="all" +license="custom" +provides="python=$pkgver-r$pkgrel" +subpackages="$pkgname-dbg $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() { + default_prepare + + # 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() { + provides="python-dev=$pkgver-r$pkgrel" + + # 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="57dffcee9cee8bb2ab5f82af1d8e9a69 Python-2.7.12.tar.xz +e2ea88671f8f838142323aedc417be48 musl-find_library.patch +dada786a50fa332686a9b9260d84c110 unchecked-ioctl.patch" +sha256sums="d7837121dd5652a05fef807c361909d255d173280c4e1a4ded94d73d80a1f978 Python-2.7.12.tar.xz +5a2ec65881816a80de25530a274aa3998684e02d82cff6565c08405df11983c0 musl-find_library.patch +f9d37609bab83d9ffff96ec9a33e16568cfb14980d389f7fe34a1c837397e359 unchecked-ioctl.patch" +sha512sums="6ddbbce47cc49597433d98ca05c2f62f07ed1070807b645602a8e9e9b996adc6fa66fa20a33cd7d23d4e7e925e25071d7301d288149fbe4e8c5f06d5438dda1f Python-2.7.12.tar.xz +dbc1538d519997175ca24c8fcb94aa20924a9be3065a44fd7693ea7eb3642f681ea0b337b72074e17baf19966b7ee6dbac1081d40e2fdc11e30b6b8a6eeb577e musl-find_library.patch +5a8e013a4132d71c4360771f130d27b37275ae59330cf9a75378dc8a11236017f540eb224f2a148984e82ca3fb6b29129375b1080ba05b81044faa717520ab82 unchecked-ioctl.patch" diff --git a/main/python2/musl-find_library.patch b/main/python2/musl-find_library.patch new file mode 100644 index 0000000000..2d8d19719c --- /dev/null +++ b/main/python2/musl-find_library.patch @@ -0,0 +1,43 @@ +diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py +index 1e882e3..b265cc0 100644 +--- a/Lib/ctypes/util.py ++++ b/Lib/ctypes/util.py +@@ -238,8 +238,37 @@ elif os.name == "posix": + return None + return res.group(1) + ++ def _is_elf(filepath): ++ try: ++ with open(filepath, 'rb') as fh: ++ return fh.read(4) == b'\x7fELF' ++ except: ++ return False ++ ++ def _find_libfile(name): ++ from glob import glob ++ # special case for libm, libcrypt and libpthread and musl ++ if name in ['m', 'crypt', 'pthread']: ++ name = 'c' ++ elif name in ['libm.so', 'libcrypt.so', 'libpthread.so']: ++ name = 'libc.so' ++ # search in standard locations ++ paths = ['/lib', '/usr/lib', '/usr/local/lib'] ++ if 'LD_LIBRARY_PATH' in os.environ: ++ paths = os.environ['LD_LIBRARY_PATH'].split(':') + paths ++ for d in paths: ++ f = os.path.join(d, name) ++ if _is_elf(f): ++ return os.path.basename(f) ++ ++ prefix = os.path.join(d, 'lib'+name) ++ for suffix in ['.so', '.so.*', '.*.so.*']: ++ for f in glob('{0}{1}'.format(prefix, suffix)): ++ if _is_elf(f): ++ return os.path.basename(f) ++ + def find_library(name): +- return _findSoname_ldconfig(name) or _get_soname(_findLib_gcc(name)) ++ return _find_libfile(name) or _findSoname_ldconfig(name) or _get_soname(_findLib_gcc(name)) + + ################################################################ + # test code diff --git a/main/python2/unchecked-ioctl.patch b/main/python2/unchecked-ioctl.patch new file mode 100644 index 0000000000..4d5564c2cb --- /dev/null +++ b/main/python2/unchecked-ioctl.patch @@ -0,0 +1,11 @@ +--- ./Modules/fcntlmodule.c.orig ++++ ./Modules/fcntlmodule.c +@@ -118,7 +118,7 @@ + int mutate_arg = 1; + char buf[IOCTL_BUFSZ+1]; /* argument plus NUL byte */ + +- if (PyArg_ParseTuple(args, "O&Iw#|i:ioctl", ++ if (PyArg_ParseTuple(args, "O&Iw#|n:ioctl", + conv_descriptor, &fd, &code, + &str, &len, &mutate_arg)) { + char *arg; |