Make rhythmbox start again after recent python 2.6.6 update.
Merged from upstream git.
This commit is contained in:
parent
b9452e2e71
commit
9b35e3b26e
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.57 2010/09/19 14:48:18 ajacoutot Exp $
|
||||
# $OpenBSD: Makefile,v 1.58 2010/09/25 18:13:13 ajacoutot Exp $
|
||||
|
||||
# coherence plugin is installed but not activated by default so we don't
|
||||
# enforce dependency on multimedia/coherence to lower requirements
|
||||
@ -8,7 +8,7 @@ COMMENT= music management application for GNOME
|
||||
GNOME_PROJECT= rhythmbox
|
||||
GNOME_VERSION= 0.12.8
|
||||
|
||||
REVISION = 5
|
||||
REVISION = 6
|
||||
|
||||
SHARED_LIBS += rhythmbox-core 0.0 # .0.0
|
||||
|
||||
|
@ -1,13 +1,47 @@
|
||||
$OpenBSD: patch-shell_main_c,v 1.5 2009/05/31 14:11:36 ajacoutot Exp $
|
||||
--- shell/main.c.orig Sat May 23 14:33:25 2009
|
||||
+++ shell/main.c Sun May 31 14:44:37 2009
|
||||
@@ -329,7 +329,9 @@ main (int argc, char **argv)
|
||||
$OpenBSD: patch-shell_main_c,v 1.6 2010/09/25 18:13:13 ajacoutot Exp $
|
||||
|
||||
From 4394826f36fad0ad36ea773b6d4525dfcfcd389b Mon Sep 17 00:00:00 2001
|
||||
From: Jonathan Matthew <jonathan@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
|
||||
|
||||
--- shell/main.c.orig Thu Mar 25 01:10:15 2010
|
||||
+++ shell/main.c Sat Sep 25 19:55:32 2010
|
||||
@@ -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 @@ main (int argc, char **argv)
|
||||
|
||||
rb_profile_start ("mainloop");
|
||||
#ifdef ENABLE_PYTHON
|
||||
pyg_begin_allow_threads;
|
||||
#endif
|
||||
+ GDK_THREADS_ENTER ();
|
||||
- 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 ();
|
||||
+ GDK_THREADS_LEAVE ();
|
||||
#ifdef ENABLE_PYTHON
|
||||
pyg_end_allow_threads;
|
||||
-#ifdef ENABLE_PYTHON
|
||||
- pyg_end_allow_threads;
|
||||
#endif
|
||||
rb_profile_end ("mainloop");
|
||||
|
||||
|
124
audio/rhythmbox/patches/patch-shell_rb-python-module_c
Normal file
124
audio/rhythmbox/patches/patch-shell_rb-python-module_c
Normal file
@ -0,0 +1,124 @@
|
||||
$OpenBSD: patch-shell_rb-python-module_c,v 1.1 2010/09/25 18:13:13 ajacoutot Exp $
|
||||
|
||||
From 4394826f36fad0ad36ea773b6d4525dfcfcd389b Mon Sep 17 00:00:00 2001
|
||||
From: Jonathan Matthew <jonathan@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
|
||||
|
||||
--- shell/rb-python-module.c.orig Thu Mar 25 01:10:15 2010
|
||||
+++ shell/rb-python-module.c Sat Sep 25 19:55:32 2010
|
||||
@@ -113,8 +113,16 @@ extern PyMethodDef pyrb_functions[];
|
||||
/* 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 @@ rb_python_module_init_python (void)
|
||||
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 @@ rb_python_module_init_python (void)
|
||||
|
||||
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 @@ rb_python_module_init_python (void)
|
||||
|
||||
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 @@ rb_python_module_init_python (void)
|
||||
#endif
|
||||
|
||||
/* import gtk */
|
||||
- init_pygtk ();
|
||||
+ actually_init_pygtk ();
|
||||
if (PyErr_Occurred ()) {
|
||||
g_warning ("Could not initialize pygtk");
|
||||
PyErr_Print();
|
||||
@@ -206,7 +219,7 @@ rb_python_module_init_python (void)
|
||||
|
||||
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 @@ rb_python_module_init_python (void)
|
||||
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 @@ rb_python_module_load_with_gil (GTypeModule *module)
|
||||
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);
|
||||
@@ -517,6 +537,12 @@ rb_python_module_new (const gchar *path,
|
||||
g_type_module_set_name (G_TYPE_MODULE (result), module);
|
||||
|
||||
return result;
|
||||
+}
|
||||
+
|
||||
+gboolean
|
||||
+rb_python_init_successful (void)
|
||||
+{
|
||||
+ return python_init_successful;
|
||||
}
|
||||
|
||||
/* --- these are not module methods, they are here out of convenience --- */
|
28
audio/rhythmbox/patches/patch-shell_rb-python-module_h
Normal file
28
audio/rhythmbox/patches/patch-shell_rb-python-module_h
Normal file
@ -0,0 +1,28 @@
|
||||
$OpenBSD: patch-shell_rb-python-module_h,v 1.1 2010/09/25 18:13:13 ajacoutot Exp $
|
||||
|
||||
From 4394826f36fad0ad36ea773b6d4525dfcfcd389b Mon Sep 17 00:00:00 2001
|
||||
From: Jonathan Matthew <jonathan@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
|
||||
|
||||
--- shell/rb-python-module.h.orig Thu Mar 25 01:10:15 2010
|
||||
+++ shell/rb-python-module.h Sat Sep 25 19:55:32 2010
|
||||
@@ -60,6 +60,8 @@ GObject *rb_python_module_new_object (RBPythonModul
|
||||
|
||||
void rb_python_module_init_python (void);
|
||||
|
||||
+gboolean rb_python_init_successful (void);
|
||||
+
|
||||
void rb_python_garbage_collect (void);
|
||||
|
||||
void rb_python_shutdown (void);
|
Loading…
Reference in New Issue
Block a user