r24546 - in /packages/unstable/rhythmbox/debian: changelog patches/02_python_fixes.patch patches/series

dktrkranz at users.alioth.debian.org dktrkranz at users.alioth.debian.org
Sat Jun 19 08:29:57 UTC 2010


Author: dktrkranz
Date: Sat Jun 19 08:29:56 2010
New Revision: 24546

URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=24546
Log:
* debian/patches/02_python_fixes.patch:
  - Fix segfault at startup with python2.6 as default Python version.

Added:
    packages/unstable/rhythmbox/debian/patches/02_python_fixes.patch
Modified:
    packages/unstable/rhythmbox/debian/changelog
    packages/unstable/rhythmbox/debian/patches/series

Modified: packages/unstable/rhythmbox/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/packages/unstable/rhythmbox/debian/changelog?rev=24546&op=diff
==============================================================================
--- packages/unstable/rhythmbox/debian/changelog [utf-8] (original)
+++ packages/unstable/rhythmbox/debian/changelog [utf-8] Sat Jun 19 08:29:56 2010
@@ -1,10 +1,12 @@
 rhythmbox (0.12.8-2) UNRELEASED; urgency=low
 
+  * debian/patches/02_python_fixes.patch:
+    - Fix segfault at startup with python2.6 as default Python version.
   * debian/control.in:
     - Let rhythmbox-plugin-coherence depend on rhythmbox-plugin, it
       needs some Python modules provided by it (Closes: #582621).
 
- -- Luca Falavigna <dktrkranz at debian.org>  Sat, 19 Jun 2010 10:10:37 +0200
+ -- Luca Falavigna <dktrkranz at debian.org>  Sat, 19 Jun 2010 10:28:38 +0200
 
 rhythmbox (0.12.8-1) unstable; urgency=low
 

Added: packages/unstable/rhythmbox/debian/patches/02_python_fixes.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/packages/unstable/rhythmbox/debian/patches/02_python_fixes.patch?rev=24546&op=file
==============================================================================
--- packages/unstable/rhythmbox/debian/patches/02_python_fixes.patch (added)
+++ packages/unstable/rhythmbox/debian/patches/02_python_fixes.patch [utf-8] Sat Jun 19 08:29:56 2010
@@ -1,0 +1,169 @@
+From 4394826f36fad0ad36ea773b6d4525dfcfcd389b Mon Sep 17 00:00:00 2001
+From: Jonathan Matthew <jonathan at d14n.org>
+Date: Wed, 05 May 2010 12:58:26 +0000
+Subject: python: fix a number of python initialization problems (bug #617587)
+
+- pygtk.require("2.8") doesn't work - it's only after a major version,
+  so we should pass in "2.0" instead
+- init_pygobject() is deprecated, use pygobject_init (and pass in the
+  version we require) instead
+- init_pygtk() is a macro that returns from the current function on
+  error, so we need to call it from a separate function for our error
+  handling to work
+- if some aspect of python initialization failed, we were still using
+  the pygobject GIL macros, which were crashing
+---
+Index: b/shell/main.c
+===================================================================
+--- a/shell/main.c	2010-06-19 10:26:17.882068005 +0200
++++ b/shell/main.c	2010-06-19 10:26:50.050059574 +0200
+@@ -35,6 +35,7 @@
+ #define NO_IMPORT_PYGOBJECT
+ #define NO_IMPORT_PYGTK
+ #include <pygobject.h>
++#include "rb-python-module.h"
+ 
+ /* make sure it's defined somehow */
+ #ifndef _XOPEN_SOURCE
+@@ -327,11 +328,15 @@
+ 
+ 		rb_profile_start ("mainloop");
+ #ifdef ENABLE_PYTHON
+-		pyg_begin_allow_threads;
+-#endif
++		if (rb_python_init_successful ()) {
++			pyg_begin_allow_threads;
++			gtk_main ();
++			pyg_end_allow_threads;
++		} else {
++			gtk_main ();
++		}
++#else
+ 		gtk_main ();
+-#ifdef ENABLE_PYTHON
+-		pyg_end_allow_threads;
+ #endif
+ 		rb_profile_end ("mainloop");
+ 
+Index: b/shell/rb-python-module.c
+===================================================================
+--- a/shell/rb-python-module.c	2010-06-19 10:26:17.958054292 +0200
++++ b/shell/rb-python-module.c	2010-06-19 10:26:50.054061013 +0200
+@@ -113,8 +113,16 @@
+ /* We retreive this to check for correct class hierarchy */
+ static PyTypeObject *PyRBPlugin_Type;
+ 
++static gboolean python_init_successful;
++
+ G_DEFINE_TYPE (RBPythonModule, rb_python_module, G_TYPE_TYPE_MODULE);
+ 
++static void
++actually_init_pygtk (void)
++{
++	init_pygtk ();
++}
++
+ void
+ rb_python_module_init_python (void)
+ {
+@@ -127,6 +135,7 @@
+ 	char *argv[] = { "rb", "rhythmdb", NULL };
+ 	GList *paths;
+ 
++	python_init_successful = FALSE;
+ 	if (Py_IsInitialized ()) {
+ 		g_warning ("Python Should only be initialized once, since it's in class_init");
+ 		g_return_if_reached ();
+@@ -159,7 +168,7 @@
+ 
+ 	PySys_SetArgv (1, argv);
+ 
+-	/* pygtk.require("2.8") */
++	/* pygtk.require("2.0") */
+ 	pygtk = PyImport_ImportModule ("pygtk");
+ 	if (pygtk == NULL) {
+ 		g_warning ("Could not import pygtk");
+@@ -169,11 +178,15 @@
+ 
+ 	mdict = PyModule_GetDict (pygtk);
+ 	require = PyDict_GetItemString (mdict, "require");
+-	PyObject_CallObject (require, Py_BuildValue ("(S)", PyString_FromString ("2.8")));
++	PyObject_CallObject (require, Py_BuildValue ("(S)", PyString_FromString ("2.0")));
++	if (PyErr_Occurred ()) {
++		g_warning ("pygtk.require(2.0) failed");
++		PyErr_Print();
++		return;
++	}
+ 
+ 	/* import gobject */
+-	init_pygobject ();
+-	if (PyErr_Occurred ()) {
++	if (pygobject_init (2, 16, 0) == NULL) {
+ 		g_warning ("Could not initialize pygobject");
+ 		PyErr_Print();
+ 		return;
+@@ -188,7 +201,7 @@
+ #endif
+ 
+ 	/* import gtk */
+-	init_pygtk ();
++	actually_init_pygtk ();
+ 	if (PyErr_Occurred ()) {
+ 		g_warning ("Could not initialize pygtk");
+ 		PyErr_Print();
+@@ -206,7 +219,7 @@
+ 
+ 	mdict = PyModule_GetDict (gtk);
+ 	pygtk_version = PyDict_GetItemString (mdict, "pygtk_version");
+-	pygtk_required_version = Py_BuildValue ("(iii)", 2, 4, 0);
++	pygtk_required_version = Py_BuildValue ("(iii)", 2, 8, 0);
+ 	if (PyObject_Compare (pygtk_version, pygtk_required_version) == -1) {
+ 		g_warning("PyGTK %s required, but %s found.",
+ 				  PyString_AsString (PyObject_Repr (pygtk_required_version)),
+@@ -298,6 +311,8 @@
+ 	gettext_args = Py_BuildValue ("ss", GETTEXT_PACKAGE, GNOMELOCALEDIR);
+ 	PyObject_CallObject (install, gettext_args);
+ 	Py_DECREF (gettext_args);
++
++	python_init_successful = TRUE;
+ }
+ 
+ static gboolean
+@@ -363,6 +378,11 @@
+ 	PyGILState_STATE state;
+ 	gboolean ret;
+ 
++	if (python_init_successful == FALSE) {
++		g_warning ("unable to load module as python runtime could not be initialized");
++		return FALSE;
++	}
++
+ 	state = pyg_gil_state_ensure ();
+ 	ret = rb_python_module_load (module);
+ 	pyg_gil_state_release (state);
+@@ -519,6 +539,12 @@
+ 	return result;
+ }
+ 
++gboolean
++rb_python_init_successful (void)
++{
++	return python_init_successful;
++}
++
+ /* --- these are not module methods, they are here out of convenience --- */
+ 
+ #if 0
+Index: b/shell/rb-python-module.h
+===================================================================
+--- a/shell/rb-python-module.h	2010-06-19 10:26:18.038054071 +0200
++++ b/shell/rb-python-module.h	2010-06-19 10:26:50.054061013 +0200
+@@ -60,6 +60,8 @@
+ 
+ void			rb_python_module_init_python		(void);
+ 
++gboolean		rb_python_init_successful		(void);
++
+ void			rb_python_garbage_collect		(void);
+ 
+ void			rb_python_shutdown			(void);

Modified: packages/unstable/rhythmbox/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-gnome/packages/unstable/rhythmbox/debian/patches/series?rev=24546&op=diff
==============================================================================
--- packages/unstable/rhythmbox/debian/patches/series [utf-8] (original)
+++ packages/unstable/rhythmbox/debian/patches/series [utf-8] Sat Jun 19 08:29:56 2010
@@ -1,1 +1,2 @@
 01_dlna_vorbis.patch
+02_python_fixes.patch




More information about the pkg-gnome-commits mailing list