Commit 6496713f authored by Jonny Lamb's avatar Jonny Lamb

Remove python bindings. (Closes bug #599039)

Signed-off-by: Jonny Lamb's avatarJonny Lamb <jonnylamb@gnome.org>
parent 90469882
......@@ -12,10 +12,6 @@ if HAVE_NOTHERE
SUBDIRS += nothere
endif
if HAVE_PYTHON
SUBDIRS += python
endif
if HAVE_TESTS
SUBDIRS += tests
endif
......
......@@ -455,41 +455,6 @@ fi
AM_CONDITIONAL(HAVE_TESTS, test "x$have_check" = "xyes")
# -----------------------------------------------------------
# Python Bindings
# -----------------------------------------------------------
AC_ARG_ENABLE(python,
AS_HELP_STRING([--enable-python=@<:@no/yes/auto@:>@],
[build python bindings to libempathy and libempathy-gtk]), ,
enable_python=auto)
if test "x$enable_python" != "xno"; then
PKG_CHECK_MODULES(PYTHON_BINDING,
[
pygtk-2.0,
glib-2.0 >= $GLIB_REQUIRED
gobject-2.0
gconf-2.0 >= $GCONF_REQUIRED
libxml-2.0
gtk+-2.0 >= $GTK_REQUIRED
gstreamer-0.10
gstreamer-interfaces-0.10
telepathy-farsight
], have_python="yes", have_python="no")
if test "x$have_python" = "xyes" ; then
AM_CHECK_PYTHON_HEADERS(,have_python="no")
AC_CHECK_PROGS([PYGOBJECTCODEGEN], [pygobject-codegen-2.0 pygtk-codegen-2.0])
fi
else
have_python=no
fi
if test "x$enable_python" = "xyes" -a "x$have_python" != "xyes"; then
AC_MSG_ERROR([Couldn't find python.])
fi
AM_CONDITIONAL(HAVE_PYTHON, test "x$have_python" = "xyes")
# -----------------------------------------------------------
# Coding style checks
# -----------------------------------------------------------
......@@ -528,9 +493,6 @@ AC_OUTPUT([
docs/libempathy-gtk/Makefile
docs/libempathy-gtk/version.xml
help/Makefile
python/Makefile
python/pyempathy/Makefile
python/pyempathygtk/Makefile
tests/Makefile
tests/xml/Makefile
tools/Makefile
......@@ -561,7 +523,6 @@ Configure summary:
Extras:
Documentation...............: ${enable_gtk_doc}
Python bindings.............: ${have_python}
Megaphone applet............: ${have_megaphone}
Nothere applet..............: ${have_nothere}
Nautilus-sendto plugin......: ${have_nst}
......
## this one is commonly used with AM_PATH_PYTHONDIR ...
dnl AM_CHECK_PYMOD(MODNAME [,SYMBOL [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]])
dnl Check if a module containing a given symbol is visible to python.
AC_DEFUN([AM_CHECK_PYMOD],
[AC_REQUIRE([AM_PATH_PYTHON])
py_mod_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`
AC_MSG_CHECKING(for ifelse([$2],[],,[$2 in ])python module $1)
AC_CACHE_VAL(py_cv_mod_$py_mod_var, [
ifelse([$2],[], [prog="
import sys
try:
import $1
except ImportError:
sys.exit(1)
except:
sys.exit(0)
sys.exit(0)"], [prog="
import $1
$1.$2"])
if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC
then
eval "py_cv_mod_$py_mod_var=yes"
else
eval "py_cv_mod_$py_mod_var=no"
fi
])
py_val=`eval "echo \`echo '$py_cv_mod_'$py_mod_var\`"`
if test "x$py_val" != xno; then
AC_MSG_RESULT(yes)
ifelse([$3], [],, [$3
])dnl
else
AC_MSG_RESULT(no)
ifelse([$4], [],, [$4
])dnl
fi
])
dnl a macro to check for ability to create python extensions
dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
dnl function also defines PYTHON_INCLUDES
AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
[AC_REQUIRE([AM_PATH_PYTHON])
AC_MSG_CHECKING(for headers required to compile python extensions)
dnl deduce PYTHON_INCLUDES
py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
if test -x "$PYTHON-config"; then
PYTHON_INCLUDES=`$PYTHON-config --includes 2>/dev/null`
else
PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
if test "$py_prefix" != "$py_exec_prefix"; then
PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
fi
fi
AC_SUBST(PYTHON_INCLUDES)
dnl check if the headers exist:
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
AC_TRY_CPP([#include <Python.h>],dnl
[AC_MSG_RESULT(found)
$1],dnl
[AC_MSG_RESULT(not found)
$2])
CPPFLAGS="$save_CPPFLAGS"
])
pyempathy.c
pyempathygtk.c
SUBDIRS = pyempathy pyempathygtk
#!/usr/bin/env python
import gtk
import empathy
import empathygtk
class HelloWorld:
def destroy(self, widget, data=None):
print "destroy signal occurred"
gtk.main_quit()
def __init__(self):
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("destroy", self.destroy)
manager = empathy.ContactManager()
store = empathygtk.ContactListStore(manager)
features = empathygtk.ContactListFeatureFlags(empathygtk.CONTACT_LIST_FEATURE_NONE)
view = empathygtk.ContactListView(store, 0, features)
self.window.add (view)
view.show()
self.window.show()
def main(self):
gtk.main()
if __name__ == "__main__":
hello = HelloWorld()
hello.main()
--- /home/zdra/Desktop/pyempathy.defs 2008-04-02 11:08:02.000000000 +0200
+++ pyempathy/pyempathy.defs 2008-04-02 11:28:00.000000000 +0200
@@ -44,6 +44,7 @@
(define-object ContactManager
(in-module "Empathy")
(parent "GObject")
+ (implements "EmpathyContactList")
(c-name "EmpathyContactManager")
(gtype-id "EMPATHY_TYPE_CONTACT_MANAGER")
)
@@ -121,6 +122,7 @@
(define-object TpContactList
(in-module "Empathy")
(parent "GObject")
+ (implements "EmpathyContactList")
(c-name "EmpathyTpContactList")
(gtype-id "EMPATHY_TYPE_TP_CONTACT_LIST")
)
include $(top_srcdir)/tools/shave.mk
PYDEFS=`pkg-config --variable=defsdir pygtk-2.0`
AM_CPPFLAGS = \
-I. \
-I$(top_srcdir)/libempathy \
-I$(top_builddir)/libempathy \
-I$(top_srcdir) \
-DDATADIR=\""$(datadir)"\" \
$(PYTHON_BINDING_CFLAGS) \
$(PYTHON_INCLUDES) \
$(WARN_CFLAGS) \
$(DISABLE_DEPRECATED)
BUILT_SOURCES = \
pyempathy.c
pyempathydir = $(pyexecdir)
pyempathy_LTLIBRARIES = empathy.la
empathy_la_SOURCES = \
pyempathymodule.c
nodist_empathy_la_SOURCES = \
pyempathy.c
empathy_la_LIBADD = \
$(PYTHON_BINDING_LIBS) \
$(top_builddir)/libempathy/libempathy.la
empathy_la_LDFLAGS = \
-module -avoid-version
pyempathy.c: pyempathy.override pyempathy.defs
$(QUIET_GEN)$(PYGOBJECTCODEGEN) \
--prefix empathy \
--register $(PYDEFS)/gdk-types.defs \
--register $(PYDEFS)/gtk-types.defs \
--override $(srcdir)/pyempathy.override \
$(srcdir)/pyempathy.defs > $@
EXTRA_DIST = \
pyempathy.override \
pyempathy.defs
CLEANFILES = $(BUILT_SOURCES)
This diff is collapsed.
%%
headers
#include <Python.h>
#include <pygobject.h>
#include "empathy-account-manager.h"
#include "empathy-account-settings.h"
#include "empathy-call-factory.h"
#include "empathy-chatroom.h"
#include "empathy-chatroom-manager.h"
#include "empathy-connection-managers.h"
#include "empathy-connectivity.h"
#include "empathy-contact.h"
#include "empathy-contact-groups.h"
#include "empathy-contact-list.h"
#include "empathy-contact-manager.h"
#include "empathy-contact-monitor.h"
#include "empathy-debug.h"
#include "empathy-debugger.h"
#include "empathy-dispatcher.h"
#include "empathy-enum-types.h"
#include "empathy-ft-factory.h"
#include "empathy-ft-handler.h"
#include "empathy-idle.h"
#include "empathy-irc-network.h"
#include "empathy-irc-network-manager.h"
#include "empathy-irc-server.h"
#include "empathy-log-manager.h"
#include "empathy-log-store-empathy.h"
#include "empathy-message.h"
#include "empathy-status-presets.h"
#include "empathy-time.h"
#include "empathy-tp-call.h"
#include "empathy-tp-chat.h"
#include "empathy-tp-contact-factory.h"
#include "empathy-tp-contact-list.h"
#include "empathy-tp-file.h"
#include "empathy-tp-roomlist.h"
#include "empathy-tube-handler.h"
#include "empathy-utils.h"
void empathy_add_constants(PyObject *module, const gchar *strip_prefix);
void empathy_register_classes(PyObject *d);
%%
modulename empathy
%%
ignore-glob
*_get_type
%%
import gobject.GObject as PyGObject_Type
%%
override empathy_contact_list_get_members kwargs
static PyObject *
_wrap_empathy_contact_list_get_members(PyGObject *self, PyObject *args, PyObject *kwargs)
{
PyObject *py_contacts = PyList_New(0);
GList *l, *contacts;
contacts = empathy_contact_list_get_members(EMPATHY_CONTACT_LIST(self->obj));
for (l = contacts; l; l = l->next) {
EmpathyContact *contact;
contact = l->data;
PyList_Append(py_contacts, pygobject_new((GObject *) contact));
}
return py_contacts;
}
%%
#define NO_IMPORT_PYGOBJECT
#include <pygobject.h>
void empathy_register_classes (PyObject *d);
void empathy_add_constants(PyObject *module, const gchar *strip_prefix);
DL_EXPORT(void) initempathy(void);
extern PyMethodDef empathy_functions[];
DL_EXPORT(void)
initempathy(void)
{
PyObject *m, *d;
init_pygobject ();
m = Py_InitModule ("empathy", empathy_functions);
d = PyModule_GetDict (m);
empathy_register_classes (d);
empathy_add_constants(m, "EMPATHY_");
if (PyErr_Occurred ()) {
PyErr_Print();
Py_FatalError ("can't initialise module empathy");
}
}
--- /home/zdra/Desktop/pyempathygtk.defs 2008-04-02 11:19:27.000000000 +0200
+++ pyempathygtk/pyempathygtk.defs 2008-04-02 11:29:23.000000000 +0200
@@ -1042,10 +1042,13 @@
(return-type "GType")
)
-(define-method store_new
- (of-object "EmpathyContactList")
+(define-function empathy_contact_list_store_new
+ (is-constructor-of "EmpathyContactListStore")
(c-name "empathy_contact_list_store_new")
(return-type "EmpathyContactListStore*")
+ (parameters
+ '("EmpathyContactList*" "list_iface")
+ )
)
(define-method get_list_iface
include $(top_srcdir)/tools/shave.mk
PYDEFS=`pkg-config --variable=defsdir pygtk-2.0`
AM_CPPFLAGS = \
-I. \
-I$(top_srcdir)/libempathy-gtk \
-I$(top_builddir)/libempathy-gtk \
-I$(top_srcdir) \
-DDATADIR=\""$(datadir)"\" \
$(PYTHON_BINDING_CFLAGS) \
$(PYTHON_INCLUDES) \
$(DISABLE_DEPRECATED)
BUILT_SOURCES = \
pyempathygtk.c
pyempathygtkdir = $(pyexecdir)
pyempathygtk_LTLIBRARIES = empathygtk.la
empathygtk_la_SOURCES = \
pyempathygtkmodule.c
nodist_empathygtk_la_SOURCES = \
pyempathygtk.c
empathygtk_la_LIBADD = \
$(PYTHON_BINDING_LIBS) \
$(top_builddir)/libempathy/libempathy.la \
$(top_builddir)/libempathy-gtk/libempathy-gtk.la
empathygtk_la_LDFLAGS = \
-module -avoid-version
pyempathygtk.c: pyempathygtk.override pyempathygtk.defs
$(QUIET_GEN)$(PYGOBJECTCODEGEN) \
--prefix empathy \
--register $(PYDEFS)/gdk-types.defs \
--register $(PYDEFS)/gtk-types.defs \
--register $(srcdir)/../pyempathy/pyempathy.defs \
--override $(srcdir)/pyempathygtk.override \
$(srcdir)/pyempathygtk.defs > $@
EXTRA_DIST = \
pyempathygtk.override \
pyempathygtk.defs
CLEANFILES = $(BUILT_SOURCES)
This diff is collapsed.
%%
headers
#include <Python.h>
#include <pygobject.h>
#include <libempathy/empathy-enum-types.h>
#include "empathy-account-chooser.h"
#include "empathy-account-widget.h"
#include "empathy-account-widget-irc.h"
#include "empathy-audio-sink.h"
#include "empathy-audio-src.h"
#include "empathy-avatar-chooser.h"
#include "empathy-avatar-image.h"
#include "empathy-cell-renderer-activatable.h"
#include "empathy-cell-renderer-expander.h"
#include "empathy-cell-renderer-text.h"
#include "empathy-chat.h"
#include "empathy-chat-view.h"
#include "empathy-conf.h"
#include "empathy-contact-dialogs.h"
#include "empathy-contact-list-store.h"
#include "empathy-contact-list-view.h"
#include "empathy-contact-selector.h"
#include "empathy-contact-widget.h"
#include "empathy-geometry.h"
#include "empathy-gtk-enum-types.h"
#include "empathy-images.h"
#include "empathy-irc-network-dialog.h"
#include "empathy-kludge-label.h"
#include "empathy-log-window.h"
#include "empathy-new-message-dialog.h"
#include "empathy-presence-chooser.h"
#include "empathy-protocol-chooser.h"
#include "empathy-smiley-manager.h"
#include "empathy-spell.h"
#include "empathy-status-preset-dialog.h"
#include "empathy-theme-boxes.h"
#include "empathy-theme-irc.h"
#include "empathy-theme-manager.h"
#include "empathy-ui-utils.h"
#include "empathy-video-src.h"
#include "empathy-video-widget.h"
void empathy_add_constants(PyObject *module, const gchar *strip_prefix);
void empathy_register_classes(PyObject *d);
%%
modulename empathygtk
%%
import gobject.GObject as PyGObject_Type
import gtk.Widget as PyGtkWidget_Type
import gtk.Window as PyGtkWindow_Type
import gtk.CellRenderer as PyGtkCellRenderer_Type
import gtk.CellRendererText as PyGtkCellRendererText_Type
import gtk.TextView as PyGtkTextView_Type
import gtk.TreeView as PyGtkTreeView_Type
import gtk.TreeStore as PyGtkTreeStore_Type
import gtk.ToggleButton as PyGtkToggleButton_Type
import gtk.ComboBox as PyGtkComboBox_Type
import gtk.StatusIcon as PyGtkStatusIcon_Type
import gtk.Button as PyGtkButton_Type
import gtk.EventBox as PyGtkEventBox_Type
import gtk.CellRendererPixbuf as PyGtkCellRendererPixbuf_Type
import gtk.gdk.Pixbuf as PyGdkPixbuf_Type
import gtk.Bin as PyGtkBin_Type
import gtk.DrawingArea as PyGtkDrawingArea_Type
import gtk.ComboBoxEntry as PyGtkComboBoxEntry_Type
import gtk.Builder as PyGtkBuilder_Type
import gtk.Label as PyGtkLabel_Type
import gtk.Dialog as PyGtkDialog_Type
import gst.Bin as PyGstBin_Type
import empathy.Contact as PyEmpathyContact_Type
import empathy.ContactList as PyEmpathyContactList_Type
import empathy.TpChat as PyEmpathyTpChat_Type
import empathy.Message as PyEmpathyMessage_Type
import empathy.TpCall as PyEmpathyTpCall_Type
import empathy.FTHandler as PyEmpathyFTHandler_Type
import empathy.Account as PyEmpathyAccount_Type
import empathy.AccountSettings as PyEmpathyAccountSettings_Type
%%
ignore-glob
*_get_type
%%
ignore
empathy_chat_correct_word
empathy_chat_view_set_margin
empathy_chat_get_view
empathy_window_iconify
%%
#define NO_IMPORT_PYGOBJECT
#include <pygobject.h>
void empathy_register_classes (PyObject *d);
void empathy_add_constants(PyObject *module, const gchar *strip_prefix);
DL_EXPORT(void) initempathygtk(void);
extern PyMethodDef empathy_functions[];
DL_EXPORT(void) initempathygtk(void)
{
PyObject *m, *d;
init_pygobject ();
m = Py_InitModule ("empathygtk", empathy_functions);
d = PyModule_GetDict (m);
empathy_register_classes (d);
empathy_add_constants(m, "EMPATHY_");
if (PyErr_Occurred ()) {
PyErr_Print();
Py_FatalError ("can't initialise module empathygtk");
}
}
#! /bin/sh
#Manually update headers in pyempathy.override and pyempathygtk.override.
# Update the list of headers from Makefile.am
cd ../libempathy
python /usr/share/pygobject/2.0/codegen/h2def.py \
-m empathy \
empathy-account-settings.h \
empathy-account.h \
empathy-account-manager.h \
empathy-chatroom.h \
empathy-chatroom-manager.h \
empathy-call-factory.h \
empathy-call-handler.h \
empathy-connectivity.h \
empathy-contact.h \
empathy-contact-groups.h \
empathy-contact-list.h \
empathy-contact-manager.h \
empathy-contact-monitor.h \
empathy-connection-managers.h \
empathy-debug.h \
empathy-debugger.h \
empathy-dispatcher.h \
empathy-dispatch-operation.h \
empathy-ft-factory.h \
empathy-ft-handler.h \
empathy-idle.h \
empathy-irc-network.h \
empathy-irc-network-manager.h \
empathy-irc-server.h \
empathy-location.h \
empathy-log-manager.h \
empathy-log-store.h \
empathy-log-store-empathy.h \
empathy-message.h \
empathy-status-presets.h \
empathy-time.h \
empathy-tp-call.h \
empathy-tp-chat.h \
empathy-tp-contact-factory.h \
empathy-tp-contact-list.h \
empathy-tp-file.h \
empathy-tp-roomlist.h \
empathy-tube-handler.h \
empathy-types.h \
empathy-utils.h \
> ../python/pyempathy/pyempathy.defs
# Update the list of headers from Makefile.am
cd ../libempathy-gtk
python /usr/share/pygobject/2.0/codegen/h2def.py \
-m empathy \
empathy-account-chooser.h \
empathy-account-widget.h \
empathy-account-widget-irc.h \
empathy-account-widget-sip.h \
empathy-avatar-chooser.h \
empathy-avatar-image.h \
empathy-cell-renderer-activatable.h \
empathy-cell-renderer-expander.h \
empathy-cell-renderer-text.h \
empathy-chat.h \
empathy-chat-text-view.h \
empathy-chat-view.h \
empathy-conf.h \
empathy-contact-dialogs.h \
empathy-contact-list-store.h \
empathy-contact-list-view.h \
empathy-contact-menu.h \
empathy-share-my-desktop.h \
empathy-contact-selector.h \
empathy-contact-widget.h \
empathy-geometry.h \
empathy-audio-sink.h \
empathy-audio-src.h \
empathy-video-src.h \
empathy-video-widget.h \
empathy-images.h \
empathy-irc-network-dialog.h \
empathy-log-window.h \
empathy-new-message-dialog.h \
empathy-presence-chooser.h \
empathy-protocol-chooser.h \
empathy-smiley-manager.h \
empathy-sound.h \
empathy-spell.h \
empathy-status-preset-dialog.h \
empathy-theme-boxes.h \
empathy-theme-irc.h \
empathy-theme-manager.h \
empathy-kludge-label.h \
empathy-ui-utils.h \
> ../python/pyempathygtk/pyempathygtk.defs
# Keep original version
cd ../python
cp pyempathy/pyempathy.defs /tmp
cp pyempathygtk/pyempathygtk.defs /tmp
# Apply patches
patch -p0 < pyempathy.patch
patch -p0 < pyempathygtk.patch
# Fix define of interfaces, they are not objects
sed -e 's/define-object \(ChatView$\)/define-interface \1/' \
-i pyempathygtk/pyempathygtk.defs
sed -e 's/define-object \(ContactList$\)/define-interface \1/' \
-i pyempathy/pyempathy.defs
# Make modification then run that:
#diff -up /tmp/pyempathy.defs pyempathy/pyempathy.defs > pyempathy.patch
#diff -up /tmp/pyempathygtk.defs pyempathygtk/pyempathygtk.defs > pyempathygtk.patch
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment