diff options
author | Simon van der Linden <svdlinden@src.gnome.org> | 2009-11-08 20:03:58 +0100 |
---|---|---|
committer | Simon van der Linden <svdlinden@src.gnome.org> | 2009-11-08 20:03:58 +0100 |
commit | fdfbc90dbc9e305646b62d73de506b5e0e99cc91 (patch) | |
tree | f9fe421809f6d6fd6a2cff7f510dc8c77197a020 | |
parent | 8f53ca8a72f9958711765281dd5c5bdfb7042d7d (diff) | |
download | pygi-fdfbc90dbc9e305646b62d73de506b5e0e99cc91.tar.gz pygi-fdfbc90dbc9e305646b62d73de506b5e0e99cc91.tar.xz pygi-fdfbc90dbc9e305646b62d73de506b5e0e99cc91.zip |
Update PyGObject patches
A file, pygi-external.h, was missing in patch #3.
-rw-r--r-- | patches/0003-Add-capabilities-to-import-wrappers-from-pygi.patch | 74 | ||||
-rw-r--r-- | patches/0004-Create-instances-by-calling-tp_alloc-rather-than-PyO.patch | 2 |
2 files changed, 69 insertions, 7 deletions
diff --git a/patches/0003-Add-capabilities-to-import-wrappers-from-pygi.patch b/patches/0003-Add-capabilities-to-import-wrappers-from-pygi.patch index 6268592..582a265 100644 --- a/patches/0003-Add-capabilities-to-import-wrappers-from-pygi.patch +++ b/patches/0003-Add-capabilities-to-import-wrappers-from-pygi.patch @@ -1,4 +1,4 @@ -From 91da6efa5457a17d94d1cf5c2e4e91da078da214 Mon Sep 17 00:00:00 2001 +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 @@ -11,11 +11,13 @@ 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/pygobject.c | 14 ++++++++++++++ - gobject/pygpointer.c | 15 +++++++++++++++ - 4 files changed, 51 insertions(+), 0 deletions(-) + 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 @@ -68,6 +70,66 @@ index eb274a2..b9cf6b3 100644 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 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 index d838e4d..44f0c46 100644 --- 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 @@ -1,4 +1,4 @@ -From 55390cf85f4c532a8e281cfd96d601b0ce62fb03 Mon Sep 17 00:00:00 2001 +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 |