[arch-commits] CVS update of extra/devel/python (2 files)
Jan de Groot
jgc at archlinux.org
Thu Jan 10 17:43:42 UTC 2008
Date: Thursday, January 10, 2008 @ 12:43:42
Author: jgc
Path: /home/cvs-extra/extra/devel/python
Added: python2.6-set_wakeup_fd4.patch (1.1)
Modified: PKGBUILD (1.49 -> 1.50)
upgpkg: python 2.5.1-5
Add wakeup api from python trunk (http://blogs.gnome.org/johan/2008/01/04/enough-wakeups-in-python-programs/)
Fix tkinter module
--------------------------------+
PKGBUILD | 14 ++++--
python2.6-set_wakeup_fd4.patch | 86 +++++++++++++++++++++++++++++++++++++++
2 files changed, 95 insertions(+), 5 deletions(-)
Index: extra/devel/python/PKGBUILD
diff -u extra/devel/python/PKGBUILD:1.49 extra/devel/python/PKGBUILD:1.50
--- extra/devel/python/PKGBUILD:1.49 Mon Jan 7 17:19:08 2008
+++ extra/devel/python/PKGBUILD Thu Jan 10 12:43:41 2008
@@ -1,8 +1,8 @@
-# $Id: PKGBUILD,v 1.49 2008/01/07 22:19:08 andyrtr Exp $
+# $Id: PKGBUILD,v 1.50 2008/01/10 17:43:41 jgc Exp $
# Maintainer: Jason Chu <jason at archlinux.org>
pkgname=python
pkgver=2.5.1
-pkgrel=4
+pkgrel=5
_pybasever=2.5
pkgdesc="A high-level scripting language"
arch=('i686' 'x86_64')
@@ -16,18 +16,22 @@
source=(http://www.python.org/ftp/python/${pkgver}/Python-${pkgver}.tar.bz2
Python-2.4.4-gdbm-1.patch
db4.6-setup.py-detection.patch
- python-2.5.CVE-2007-4965-int-overflow.patch)
+ python-2.5.CVE-2007-4965-int-overflow.patch
+ python2.6-set_wakeup_fd4.patch)
md5sums=('70084ffa561660f07de466c2c8c4842d'
'2b61e06365e9fb5f3af22d946efa8be6'
'599fc8d1cb63a406d46e30c7e4b62a29'
- '491416c1b337fc61b6cdf5981d895a7d')
+ '491416c1b337fc61b6cdf5981d895a7d'
+ 'e9f8c840ba4a2bf1ea73102fd333352e')
build() {
cd ${startdir}/src/Python-${pkgver}
patch -Np1 -i ${startdir}/src/Python-2.4.4-gdbm-1.patch || return 1
patch -Np0 -i ${startdir}/src/db4.6-setup.py-detection.patch || return 1
# fix http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-4965
- patch -Np1 -i ../python-2.5.CVE-2007-4965-int-overflow.patch || return 1
+ patch -Np1 -i ${startdir}/src//python-2.5.CVE-2007-4965-int-overflow.patch || return 1
+
+ patch -Np1 -i ${startdir}/src/python2.6-set_wakeup_fd4.patch || return 1
./configure --prefix=/usr --enable-shared --with-threads --enable-unicode
# This is supposed to be the previous version's python directory
Index: extra/devel/python/python2.6-set_wakeup_fd4.patch
diff -u /dev/null extra/devel/python/python2.6-set_wakeup_fd4.patch:1.1
--- /dev/null Thu Jan 10 12:43:42 2008
+++ extra/devel/python/python2.6-set_wakeup_fd4.patch Thu Jan 10 12:43:42 2008
@@ -0,0 +1,86 @@
+diff -rup Python-2.5.1-orig/Modules/signalmodule.c Python-2.5.1/Modules/signalmodule.c
+--- Python-2.5.1-orig/Modules/signalmodule.c 2006-01-19 01:09:39.000000000 -0500
++++ Python-2.5.1/Modules/signalmodule.c 2008-01-07 12:32:00.000000000 -0500
+@@ -12,6 +12,8 @@
+
+ #include <signal.h>
+
++#include <sys/stat.h>
++
+ #ifndef SIG_ERR
+ #define SIG_ERR ((PyOS_sighandler_t)(-1))
+ #endif
+@@ -75,6 +77,8 @@ static struct {
+ PyObject *func;
+ } Handlers[NSIG];
+
++static int wakeup_fd = -1;
++
+ static int is_tripped = 0; /* Speed up sigcheck() when none tripped */
+
+ static PyObject *DefaultHandler;
+@@ -112,6 +116,7 @@ checksignals_witharg(void * unused)
+ static void
+ signal_handler(int sig_num)
+ {
++ const char dummy_byte = '\0';
+ #ifdef WITH_THREAD
+ #ifdef WITH_PTH
+ if (PyThread_get_thread_ident() != main_thread) {
+@@ -125,6 +130,8 @@ signal_handler(int sig_num)
+ is_tripped++;
+ Handlers[sig_num].tripped = 1;
+ Py_AddPendingCall(checksignals_witharg, NULL);
++ if (wakeup_fd != -1)
++ write(wakeup_fd, &dummy_byte, 1);
+ #ifdef WITH_THREAD
+ }
+ #endif
+@@ -264,6 +271,39 @@ None -- if an unknown handler is in effe
+ anything else -- the callable Python object used as a handler");
+
+
++static PyObject *
++signal_set_wakeup_fd(PyObject *self, PyObject *args)
++{
++ struct stat buf;
++ int fd, old_fd;
++ if (!PyArg_ParseTuple(args, "i:set_wakeup_fd", &fd))
++ return NULL;
++#ifdef WITH_THREAD
++ if (PyThread_get_thread_ident() != main_thread) {
++ PyErr_SetString(PyExc_ValueError,
++ "set_wakeup_fd only works in main thread");
++ return NULL;
++ }
++#endif
++ if (fd != -1 && fstat(fd, &buf) != 0) {
++ PyErr_SetString(PyExc_ValueError, "invalid fd");
++ return NULL;
++ }
++ old_fd = wakeup_fd;
++ wakeup_fd = fd;
++ return PyLong_FromLong(old_fd);
++}
++
++PyDoc_STRVAR(set_wakeup_fd_doc,
++"set_wakeup_fd(fd) -> fd\n\
++\n\
++Sets the fd to be written to (with '\\0') when a signal\n\
++comes in. A library can use this to wakeup select or poll.\n\
++The previous fd is returned.\n\
++\n\
++The fd must be non-blocking.");
++
++
+ /* List of functions defined in the module */
+ static PyMethodDef signal_methods[] = {
+ #ifdef HAVE_ALARM
+@@ -271,6 +311,7 @@ static PyMethodDef signal_methods[] = {
+ #endif
+ {"signal", signal_signal, METH_VARARGS, signal_doc},
+ {"getsignal", signal_getsignal, METH_VARARGS, getsignal_doc},
++ {"set_wakeup_fd", signal_set_wakeup_fd, METH_VARARGS, set_wakeup_fd_doc},
+ #ifdef HAVE_PAUSE
+ {"pause", (PyCFunction)signal_pause,
+ METH_NOARGS,pause_doc},
More information about the arch-commits
mailing list