diff options
author | Simon van der Linden <svdlinden@src.gnome.org> | 2009-11-09 22:44:12 +0100 |
---|---|---|
committer | Simon van der Linden <svdlinden@src.gnome.org> | 2009-11-09 22:44:12 +0100 |
commit | 734755912fff11332dc0e96317b7d6b7c4014e6a (patch) | |
tree | 91babb531ca6139221465b6dc29663f61ba26be1 | |
parent | fdfbc90dbc9e305646b62d73de506b5e0e99cc91 (diff) | |
download | pygi-734755912fff11332dc0e96317b7d6b7c4014e6a.tar.gz pygi-734755912fff11332dc0e96317b7d6b7c4014e6a.tar.xz pygi-734755912fff11332dc0e96317b7d6b7c4014e6a.zip |
Remove PyGObject patches since they've been merged to master
4 files changed, 0 insertions, 493 deletions
diff --git a/patches/0001-Make-GType.pytype-aware-of-the-interface-enum-flags-.patch b/patches/0001-Make-GType.pytype-aware-of-the-interface-enum-flags-.patch deleted file mode 100644 index 61bdddb..0000000 --- a/patches/0001-Make-GType.pytype-aware-of-the-interface-enum-flags-.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 421c03b1c5b69f90c778663df901b45ca3ee8ba5 Mon Sep 17 00:00:00 2001 -From: Simon van der Linden <svdlinden@src.gnome.org> -Date: Fri, 6 Nov 2009 19:17:36 +0100 -Subject: [PATCH 1/4] Make GType.pytype aware of the interface, enum, flags, pointer and boxed wrappers - ---- - gobject/pygtype.c | 39 +++++++++++++++++++++++++++++++++------ - 1 files changed, 33 insertions(+), 6 deletions(-) - -diff --git a/gobject/pygtype.c b/gobject/pygtype.c -index 601ea83..782e998 100644 ---- a/gobject/pygtype.c -+++ b/gobject/pygtype.c -@@ -70,12 +70,36 @@ pyg_type_wrapper_dealloc(PyGTypeWrapper *self) - PyObject_DEL(self); - } - -+static GQuark -+_pyg_type_key(GType type) { -+ GQuark key; -+ -+ if (g_type_is_a(type, G_TYPE_INTERFACE)) { -+ key = pyginterface_type_key; -+ } else if (g_type_is_a(type, G_TYPE_ENUM)) { -+ key = pygenum_class_key; -+ } else if (g_type_is_a(type, G_TYPE_FLAGS)) { -+ key = pygflags_class_key; -+ } else if (g_type_is_a(type, G_TYPE_POINTER)) { -+ key = pygpointer_class_key; -+ } else if (g_type_is_a(type, G_TYPE_BOXED)) { -+ key = pygboxed_type_key; -+ } else { -+ key = pygobject_class_key; -+ } -+ -+ return key; -+} -+ - static PyObject * - _wrap_g_type_wrapper__get_pytype(PyGTypeWrapper *self, void *closure) - { -+ GQuark key; - PyObject *py_type; -- -- py_type = g_type_get_qdata(self->type, pygobject_class_key); -+ -+ key = _pyg_type_key(self->type); -+ -+ py_type = g_type_get_qdata(self->type, key); - if (!py_type) - py_type = Py_None; - -@@ -86,15 +110,18 @@ _wrap_g_type_wrapper__get_pytype(PyGTypeWrapper *self, void *closure) - static int - _wrap_g_type_wrapper__set_pytype(PyGTypeWrapper *self, PyObject* value, void *closure) - { -+ GQuark key; - PyObject *py_type; -- -- py_type = g_type_get_qdata(self->type, pygobject_class_key); -+ -+ key = _pyg_type_key(self->type); -+ -+ py_type = g_type_get_qdata(self->type, key); - Py_CLEAR(py_type); - if (value == Py_None) -- g_type_set_qdata(self->type, pygobject_class_key, NULL); -+ g_type_set_qdata(self->type, key, NULL); - else if (PyType_Check(value)) { - Py_INCREF(value); -- g_type_set_qdata(self->type, pygobject_class_key, value); -+ g_type_set_qdata(self->type, key, value); - } else { - PyErr_SetString(PyExc_TypeError, "Value must be None or a type object"); - return -1; --- -1.6.3.3 - diff --git a/patches/0002-Fix-girpository-build-setup.patch b/patches/0002-Fix-girpository-build-setup.patch deleted file mode 100644 index 9bff664..0000000 --- a/patches/0002-Fix-girpository-build-setup.patch +++ /dev/null @@ -1,186 +0,0 @@ -From bfd3100a580b8bea9db25b8bb7443fb8c3dbe1cc Mon Sep 17 00:00:00 2001 -From: Simon van der Linden <svdlinden@src.gnome.org> -Date: Sat, 7 Nov 2009 13:23:53 +0100 -Subject: [PATCH 2/4] Fix girpository build setup - ---- - configure.ac | 21 ++++++---- - girepository/Makefile.am | 13 +++--- - m4/introspection.m4 | 92 ++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 111 insertions(+), 15 deletions(-) - create mode 100644 m4/introspection.m4 - -diff --git a/configure.ac b/configure.ac -index 64aeaa5..0bf7610 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -200,14 +200,19 @@ if test -n "$export_dynamic"; then - GIOUNIX_LIBS=`echo $GIOUNIX_LIBS | sed -e "s/$export_dynamic//"` - fi - --dnl gobject_introspection --PKG_CHECK_MODULES(GOBJECT_INTROSPECTION, gobject-introspection-1.0 >= gobject_introspection_required_version, -- have_gobject_introspection=true, have_gobject_introspection=false) --AC_SUBST(GOBJECT_INTROSPECTION_CFLAGS) --AC_SUBST(GOBJECT_INTROSPECTION_LIBS) --AM_CONDITIONAL(BUILD_GOBJECT_INTROSPECTION, $have_gobject_introspection) --if test -n "$export_dynamic"; then -- GOBJECT_INTROSPECTION_LIBS=`echo $GOBJECT_INTROSPECTION_LIBS | sed -e "s/$export_dynamic//"` -+dnl gi -+AC_ARG_ENABLE(introspection, -+ AC_HELP_STRING([--enable-introspection], [Enable gobject-introspection bindings building]), -+ enable_introspection=$enableval, -+ enable_introspection=no) -+AM_CONDITIONAL(BUILD_GIREPOSITORY, test "$enable_introspection" != no) -+if test "$enable_introspection" != no; then -+ PKG_CHECK_MODULES(GOBJECT_INTROSPECTION, gobject-introspection-1.0 >= gobject_introspection_required_version) -+ AC_SUBST(GOBJECT_INTROSPECTION_CFLAGS) -+ AC_SUBST(GOBJECT_INTROSPECTION_LIBS) -+ if test -n "$export_dynamic"; then -+ GOBJECT_INTROSPECTION_LIBS=`echo $GOBJECT_INTROSPECTION_LIBS | sed -e "s/$export_dynamic//"` -+ fi - fi - - dnl add required cflags ... -diff --git a/girepository/Makefile.am b/girepository/Makefile.am -index c414652..8bdb462 100644 ---- a/girepository/Makefile.am -+++ b/girepository/Makefile.am -@@ -1,17 +1,16 @@ - AUTOMAKE_OPTIONS = 1.7 - PLATFORM_VERSION = 2.0 - -+pkgpyexecdir = $(pyexecdir)/gtk-2.0/girepository -+ -+if BUILD_GIREPOSITORY -+ - INCLUDES = \ - -I$(top_srcdir)/gobject \ - $(PYTHON_INCLUDES) \ - $(PYGOBJECT_CFLAGS) \ - $(GOBJECT_INTROSPECTION_CFLAGS) - --pkginclude_HEADERS = bank.h -- --# girepository extension modules --pkgpyexecdir = $(pyexecdir)/gtk-2.0/girepository -- - # girepository python scripts - pygirepositorydir = $(pkgpyexecdir) - pygirepository_PYTHON = \ -@@ -44,7 +43,6 @@ repo_la_SOURCES = \ - bank.c \ - bank.h - --if BUILD_GOBJECT_INTROSPECTION - pygirepository_LTLIBRARIES = repo.la - - all: $(pygirepository_LTLIBRARIES:.la=.so) -@@ -52,4 +50,5 @@ clean-local: - rm -f $(pygirepository_LTLIBRARIES:.la=.so) - .la.so: - $(LN_S) .libs/$@ $@ || true --endif -+ -+endif # BUILD_GIREPOSITORY -diff --git a/m4/introspection.m4 b/m4/introspection.m4 -new file mode 100644 -index 0000000..6e2c565 ---- /dev/null -+++ b/m4/introspection.m4 -@@ -0,0 +1,92 @@ -+dnl -*- mode: autoconf -*- -+dnl Copyright 2009 Johan Dahlin -+dnl -+dnl This file is free software; the author(s) gives unlimited -+dnl permission to copy and/or distribute it, with or without -+dnl modifications, as long as this notice is preserved. -+dnl -+ -+# serial 1 -+ -+m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL], -+[ -+ AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first -+ AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first -+ AC_BEFORE([LT_INIT],[$0])dnl setup libtool first -+ -+ dnl enable/disable introspection -+ m4_if([$2], [require], -+ [dnl -+ enable_introspection=yes -+ ],[dnl -+ AC_ARG_ENABLE(introspection, -+ AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]], -+ [Enable introspection for this build]),, -+ [enable_introspection=auto]) -+ ])dnl -+ -+ AC_MSG_CHECKING([for gobject-introspection]) -+ -+ dnl presence/version checking -+ AS_CASE([$enable_introspection], -+ [no], [dnl -+ found_introspection="no (disabled, use --enable-introspection to enable)" -+ ],dnl -+ [yes],[dnl -+ PKG_CHECK_EXISTS([gobject-introspection-1.0],, -+ AC_MSG_ERROR([gobject-introspection-1.0 is not installed])) -+ PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], -+ found_introspection=yes, -+ AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME])) -+ ],dnl -+ [auto],[dnl -+ PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no) -+ ],dnl -+ [dnl -+ AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@]) -+ ])dnl -+ -+ AC_MSG_RESULT([$found_introspection]) -+ -+ INTROSPECTION_SCANNER= -+ INTROSPECTION_COMPILER= -+ INTROSPECTION_GENERATE= -+ INTROSPECTION_GIRDIR= -+ INTROSPECTION_TYPELIBDIR= -+ if test "x$found_introspection" = "xyes"; then -+ INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0` -+ INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0` -+ INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0` -+ INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0` -+ INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)" -+ INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0` -+ INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0` -+ fi -+ AC_SUBST(INTROSPECTION_SCANNER) -+ AC_SUBST(INTROSPECTION_COMPILER) -+ AC_SUBST(INTROSPECTION_GENERATE) -+ AC_SUBST(INTROSPECTION_GIRDIR) -+ AC_SUBST(INTROSPECTION_TYPELIBDIR) -+ AC_SUBST(INTROSPECTION_CFLAGS) -+ AC_SUBST(INTROSPECTION_LIBS) -+ -+ AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes") -+]) -+ -+ -+dnl Usage: -+dnl GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version]) -+ -+AC_DEFUN([GOBJECT_INTROSPECTION_CHECK], -+[ -+ _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1]) -+]) -+ -+dnl Usage: -+dnl GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version]) -+ -+ -+AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE], -+[ -+ _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require]) -+]) --- -1.6.3.3 - diff --git a/patches/0003-Add-capabilities-to-import-wrappers-from-pygi.patch b/patches/0003-Add-capabilities-to-import-wrappers-from-pygi.patch deleted file mode 100644 index 582a265..0000000 --- a/patches/0003-Add-capabilities-to-import-wrappers-from-pygi.patch +++ /dev/null @@ -1,200 +0,0 @@ -From a727be30ba283027b2c8a5a3e1c60f85b45a8667 Mon Sep 17 00:00:00 2001 -From: Simon van der Linden <svdlinden@src.gnome.org> -Date: Sat, 7 Nov 2009 16:43:35 +0100 -Subject: [PATCH 3/4] Add capabilities to import wrappers from pygi - -At instance creation for boxed and pointers, at lookup for objects, -when the gtype has no wrapper yet, a wrapper may be imported from pygi. - -The feature is turned on at configure time by --enable-pygi. - -Because we couldn't create a circular build dependency, PyGI's import function and -API definition had to be copied in this tree. ---- - configure.ac | 8 +++++++ - gobject/pygboxed.c | 14 ++++++++++++ - gobject/pygi-external.h | 54 +++++++++++++++++++++++++++++++++++++++++++++++ - gobject/pygobject.c | 14 ++++++++++++ - gobject/pygpointer.c | 15 +++++++++++++ - 5 files changed, 105 insertions(+), 0 deletions(-) - create mode 100644 gobject/pygi-external.h - -diff --git a/configure.ac b/configure.ac -index 0bf7610..dc8dea6 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -215,6 +215,14 @@ if test "$enable_introspection" != no; then - fi - fi - -+AC_ARG_ENABLE(pygi, -+ AC_HELP_STRING([--enable-pygi], [Use PyGI to create wrappers for introspection-enabled types]), -+ enable_pygi=$enableval, -+ enable_pygi=no) -+if test "$enable_pygi" != no; then -+ AC_DEFINE(ENABLE_PYGI,1,Use PyGI to create wrappers for introspection-enabled types) -+fi -+ - dnl add required cflags ... - if test "x$GCC" = "xyes"; then - JH_ADD_CFLAG([-Wall]) -diff --git a/gobject/pygboxed.c b/gobject/pygboxed.c -index eb274a2..b9cf6b3 100644 ---- a/gobject/pygboxed.c -+++ b/gobject/pygboxed.c -@@ -28,6 +28,10 @@ - #include "pygobject-private.h" - #include "pygboxed.h" - -+#if ENABLE_PYGI -+# include "pygi-external.h" -+#endif -+ - GQuark pygboxed_type_key; - GQuark pygboxed_marshal_key; - -@@ -182,6 +186,16 @@ pyg_boxed_new(GType boxed_type, gpointer boxed, gboolean copy_boxed, - } - - tp = g_type_get_qdata(boxed_type, pygboxed_type_key); -+ -+#if ENABLE_PYGI -+ if (tp == NULL && _pygi_import() == 0) { -+ tp = (PyTypeObject *)pygi_type_import_by_g_type(boxed_type); -+ if (tp == NULL) { -+ PyErr_Clear(); -+ } -+ } -+#endif /* ENABLE_PYGI */ -+ - if (!tp) - tp = (PyTypeObject *)&PyGBoxed_Type; /* fallback */ - self = PyObject_NEW(PyGBoxed, tp); -diff --git a/gobject/pygi-external.h b/gobject/pygi-external.h -new file mode 100644 -index 0000000..51eef77 ---- /dev/null -+++ b/gobject/pygi-external.h -@@ -0,0 +1,54 @@ -+/* -*- Mode: C; c-basic-offset: 4 -*- -+ * vim: tabstop=4 shiftwidth=4 expandtab -+ */ -+ -+#ifndef _PYGI_EXTERNAL_H_ -+#define _PYGI_EXTERNAL_H_ -+ -+#include <Python.h> -+#include <glib.h> -+ -+struct PyGI_API { -+ PyObject* (*type_import_by_g_type) (GType g_type); -+}; -+ -+static struct PyGI_API *PyGI_API = NULL; -+ -+#define pygi_type_import_by_g_type (PyGI_API->type_import_by_g_type) -+ -+static int -+_pygi_import (void) -+{ -+ PyObject *module; -+ PyObject *api; -+ -+ if (PyGI_API != NULL) { -+ return 1; -+ } -+ -+ module = PyImport_ImportModule("gi"); -+ if (module == NULL) { -+ return -1; -+ } -+ -+ api = PyObject_GetAttrString(module, "_API"); -+ if (api == NULL) { -+ Py_DECREF(module); -+ return -1; -+ } -+ if (!PyCObject_Check(api)) { -+ Py_DECREF(module); -+ Py_DECREF(api); -+ PyErr_Format(PyExc_TypeError, "gi._API must be cobject, not %s", -+ api->ob_type->tp_name); -+ return -1; -+ } -+ -+ PyGI_API = (struct PyGI_API *)PyCObject_AsVoidPtr(api); -+ -+ Py_DECREF(api); -+ -+ return 0; -+} -+ -+#endif /* _PYGI_EXTERNAL_H_ */ -diff --git a/gobject/pygobject.c b/gobject/pygobject.c -index b4274e1..19c90ff 100644 ---- a/gobject/pygobject.c -+++ b/gobject/pygobject.c -@@ -29,6 +29,10 @@ - #include "pyginterface.h" - #include "pygparamspec.h" - -+#if ENABLE_PYGI -+# include "pygi-external.h" -+#endif -+ - - static void pygobject_dealloc(PyGObject *self); - static int pygobject_traverse(PyGObject *self, visitproc visit, void *arg); -@@ -871,6 +875,16 @@ pygobject_lookup_class(GType gtype) - py_type = g_type_get_qdata(gtype, pygobject_class_key); - if (py_type == NULL) { - py_type = g_type_get_qdata(gtype, pyginterface_type_key); -+ -+#if ENABLE_PYGI -+ if (py_type == NULL && _pygi_import() == 0) { -+ py_type = (PyTypeObject *)pygi_type_import_by_g_type(gtype); -+ if (py_type == NULL) { -+ PyErr_Clear(); -+ } -+ } -+#endif /* ENABLE_PYGI */ -+ - if (py_type == NULL) { - py_type = pygobject_new_with_interfaces(gtype); - g_type_set_qdata(gtype, pyginterface_type_key, py_type); -diff --git a/gobject/pygpointer.c b/gobject/pygpointer.c -index ee0a8da..cdcb320 100644 ---- a/gobject/pygpointer.c -+++ b/gobject/pygpointer.c -@@ -28,6 +28,11 @@ - #include "pygobject-private.h" - #include "pygpointer.h" - -+#if ENABLE_PYGI -+# include "pygi-external.h" -+#endif -+ -+ - GQuark pygpointer_class_key; - - PYGLIB_DEFINE_TYPE("gobject.GPointer", PyGPointer_Type, PyGPointer); -@@ -155,6 +160,16 @@ pyg_pointer_new(GType pointer_type, gpointer pointer) - } - - tp = g_type_get_qdata(pointer_type, pygpointer_class_key); -+ -+#if ENABLE_PYGI -+ if (tp == NULL && _pygi_import() == 0) { -+ tp = (PyTypeObject *)pygi_type_import_by_g_type(pointer_type); -+ if (tp == NULL) { -+ PyErr_Clear(); -+ } -+ } -+#endif /* ENABLE_PYGI */ -+ - if (!tp) - tp = (PyTypeObject *)&PyGPointer_Type; /* fallback */ - self = PyObject_NEW(PyGPointer, tp); --- -1.6.3.3 - diff --git a/patches/0004-Create-instances-by-calling-tp_alloc-rather-than-PyO.patch b/patches/0004-Create-instances-by-calling-tp_alloc-rather-than-PyO.patch deleted file mode 100644 index 44f0c46..0000000 --- a/patches/0004-Create-instances-by-calling-tp_alloc-rather-than-PyO.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 44378cd12b9ffb9a323bc529403266c27baad1a5 Mon Sep 17 00:00:00 2001 -From: Simon van der Linden <svdlinden@src.gnome.org> -Date: Sat, 7 Nov 2009 23:42:07 +0100 -Subject: [PATCH 4/4] Create instances by calling tp_alloc rather than PyObject_NEW - -PyObject_NEW calls a generic allocator and should only be called by tp_new, knowing -that the type's free function agrees. In pyg_boxed_new, we may allocate -PyGBoxed subtypes, so the subtype's allocation function must be called instead. ---- - gobject/pygboxed.c | 3 ++- - 1 files changed, 2 insertions(+), 1 deletions(-) - -diff --git a/gobject/pygboxed.c b/gobject/pygboxed.c -index b9cf6b3..220bf27 100644 ---- a/gobject/pygboxed.c -+++ b/gobject/pygboxed.c -@@ -198,7 +198,8 @@ pyg_boxed_new(GType boxed_type, gpointer boxed, gboolean copy_boxed, - - if (!tp) - tp = (PyTypeObject *)&PyGBoxed_Type; /* fallback */ -- self = PyObject_NEW(PyGBoxed, tp); -+ -+ self = (PyGBoxed *)tp->tp_alloc(tp, 0); - - if (self == NULL) { - pyglib_gil_state_release(state); --- -1.6.3.3 - |