Accepting request 69632 from devel:languages:python

Update to 2.28.4 (forwarded request 69605 from dimstar)

OBS-URL: https://build.opensuse.org/request/show/69632
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-gobject?expand=0&rev=6
This commit is contained in:
Berthold Gunreben 2011-05-12 08:55:51 +00:00 committed by Git OBS Bridge
parent af9d21a94b
commit d8ef5233d5
5 changed files with 104 additions and 210 deletions

View File

@ -1,187 +0,0 @@
diff --git a/gi/gimodule.c b/gi/gimodule.c
index 89caf4e..f7624ae 100644
--- a/gi/gimodule.c
+++ b/gi/gimodule.c
@@ -328,7 +328,7 @@ PYGLIB_MODULE_START(_gi, "_gi")
_pygi_boxed_register_types (module);
_pygi_argument_init();
- api = PyCObject_FromVoidPtr ( (void *) &CAPI, NULL);
+ api = PYGLIB_CPointer_WrapPointer ( (void *) &CAPI, "gi._API");
if (api == NULL) {
return;
}
diff --git a/gi/pygi.h b/gi/pygi.h
index c5a0f26..1d3d686 100644
--- a/gi/pygi.h
+++ b/gi/pygi.h
@@ -83,8 +83,11 @@ _pygi_import (void)
if (PyGI_API != NULL) {
return 1;
}
-
+#if PY_VERSION_HEX >= 0x02070000
+ PyGI_API = (struct PyGI_API*) PyCapsule_Import("gi._API", FALSE);
+#else
PyGI_API = (struct PyGI_API*) PyCObject_Import("gi", "_API");
+#endif
if (PyGI_API == NULL) {
return -1;
}
diff --git a/glib/glibmodule.c b/glib/glibmodule.c
index 4a58bc2..29a4713 100644
--- a/glib/glibmodule.c
+++ b/glib/glibmodule.c
@@ -797,7 +797,7 @@ pyglib_register_api(PyObject *d)
/* for addon libraries ... */
PyDict_SetItemString(d, "_PyGLib_API",
- o=PyCObject_FromVoidPtr(&pyglib_api,NULL));
+ o=PYGLIB_CPointer_WrapPointer(&pyglib_api,"glib._PyGLib_API"));
Py_DECREF(o);
pyglib_init_internal(o);
diff --git a/glib/pyglib-python-compat.h b/glib/pyglib-python-compat.h
index bb7bcad..097a6ab 100644
--- a/glib/pyglib-python-compat.h
+++ b/glib/pyglib-python-compat.h
@@ -41,6 +41,34 @@ typedef int Py_ssize_t;
typedef inquiry lenfunc;
#endif
+/* PyCObject superceded by PyCapsule on Python >= 2.7
+ * However since this effects header files used by
+ * static bindings we are only applying the change to
+ * Python 3.x where we don't support the static bindings.
+ * 3.2 removed PyCObject so we don't have any choice here.
+ *
+ * For SUSE we need to apply this for 2.7 and above because
+ * the deprecated code fails when warnings are turned into
+ * exceptions. When this is undeprecated, the patch becomes obsolete.
+ * */
+#if PY_VERSION_HEX >= 0x02070000
+# define PYGLIB_CPointer_Check PyCapsule_CheckExact
+# define PYGLIB_CPointer_WrapPointer(ptr, typename) \
+ PyCapsule_New(ptr, typename, NULL)
+# define PYGLIB_CPointer_GetPointer(obj, typename) \
+ PyCapsule_GetPointer(obj, typename)
+# define PYGLIB_CPointer_Import(module, symbol) \
+ PyCapsule_Import(##module##.##symbol##, FALSE)
+#else
+# define PYGLIB_CPointer_Check PyCObject_Check
+# define PYGLIB_CPointer_WrapPointer(ptr, typename) \
+ PyCObject_FromVoidPtr(ptr, NULL)
+# define PYGLIB_CPointer_GetPointer(obj, typename) \
+ PyCObject_AsVoidPtr(obj)
+# define PYGLIB_CPointer_Import(module, symbol) \
+ PyCObject_Import(module, symbol)
+#endif
+
#if PY_VERSION_HEX < 0x03000000
#define PYGLIB_INIT_FUNCTION(modname, fullpkgname, functions) \
diff --git a/glib/pyglib.c b/glib/pyglib.c
index 07db579..c85a628 100644
--- a/glib/pyglib.c
+++ b/glib/pyglib.c
@@ -71,8 +71,8 @@ pyglib_init(void)
}
cobject = PyObject_GetAttrString(glib, "_PyGLib_API");
- if (cobject && PyCObject_Check(cobject))
- _PyGLib_API = (struct _PyGLib_Functions *) PyCObject_AsVoidPtr(cobject);
+ if (cobject && PYGLIB_CPointer_Check(cobject))
+ _PyGLib_API = (struct _PyGLib_Functions *) PYGLIB_CPointer_GetPointer(cobject, "glib._PyGLib_API");
else {
PyErr_SetString(PyExc_ImportError,
"could not import glib (could not find _PyGLib_API object)");
@@ -88,7 +88,7 @@ pyglib_init(void)
void
pyglib_init_internal(PyObject *api)
{
- _PyGLib_API = (struct _PyGLib_Functions *) PyCObject_AsVoidPtr(api);
+ _PyGLib_API = (struct _PyGLib_Functions *) PYGLIB_CPointer_GetPointer(api, "glib._PyGLib_API");
}
gboolean
diff --git a/glib/pygoptioncontext.c b/glib/pygoptioncontext.c
index 1d67ac5..93d9b24 100644
--- a/glib/pygoptioncontext.c
+++ b/glib/pygoptioncontext.c
@@ -288,7 +288,7 @@ pyg_option_context_richcompare(PyObject *self, PyObject *other, int op)
static PyObject *
pyg_option_get_context(PyGOptionContext *self)
{
- return PyCObject_FromVoidPtr(self->context, NULL);
+ return PYGLIB_CPointer_WrapPointer(self->context, "goption.context");
}
static PyMethodDef pyg_option_context_methods[] = {
diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c
index ca3a2d8..9d4b0a7 100644
--- a/gobject/gobjectmodule.c
+++ b/gobject/gobjectmodule.c
@@ -2512,7 +2512,7 @@ pygobject_register_api(PyObject *d)
{
PyObject *api;
- api = PyCObject_FromVoidPtr(&pygobject_api_functions,NULL);
+ api = PYGLIB_CPointer_WrapPointer(&pygobject_api_functions, "gobject._PyGObject_API");
PyDict_SetItemString(d, "_PyGObject_API", api);
Py_DECREF(api);
}
diff --git a/gobject/pygobject.h b/gobject/pygobject.h
index 6555392..434ba3f 100644
--- a/gobject/pygobject.h
+++ b/gobject/pygobject.h
@@ -354,8 +354,14 @@ pygobject_init(int req_major, int req_minor, int req_micro)
}
cobject = PyObject_GetAttrString(gobject, "_PyGObject_API");
+#if PY_VERSION_HEX >= 0x02070000
+ if (cobject && PyCapsule_CheckExact(cobject))
+ _PyGObject_API = (struct _PyGObject_Functions *) PyCapsule_GetPointer(cobject, "gobject._PyGObject_API");
+
+#else
if (cobject && PyCObject_Check(cobject))
_PyGObject_API = (struct _PyGObject_Functions *) PyCObject_AsVoidPtr(cobject);
+#endif
else {
PyErr_SetString(PyExc_ImportError,
"could not import gobject (could not find _PyGObject_API object)");
diff --git a/gobject/pygtype.c b/gobject/pygtype.c
index 8536bed..0cbf8cd 100644
--- a/gobject/pygtype.c
+++ b/gobject/pygtype.c
@@ -890,8 +890,8 @@ pyg_value_from_pyobject(GValue *value, PyObject *obj)
else if (PyObject_TypeCheck(obj, &PyGPointer_Type) &&
G_VALUE_HOLDS(value, ((PyGPointer *)obj)->gtype))
g_value_set_pointer(value, pyg_pointer_get(obj, gpointer));
- else if (PyCObject_Check(obj))
- g_value_set_pointer(value, PyCObject_AsVoidPtr(obj));
+ else if (PYGLIB_CPointer_Check(obj))
+ g_value_set_pointer(value, PYGLIB_CPointer_GetPointer(obj, NULL));
else
return -1;
break;
@@ -936,15 +936,15 @@ pyg_value_from_pyobject(GValue *value, PyObject *obj)
}
else if ((bm = pyg_type_lookup(G_VALUE_TYPE(value))) != NULL)
return bm->tovalue(value, obj);
- else if (PyCObject_Check(obj))
- g_value_set_boxed(value, PyCObject_AsVoidPtr(obj));
+ else if (PYGLIB_CPointer_Check(obj))
+ g_value_set_boxed(value, PYGLIB_CPointer_GetPointer(obj, NULL));
else
return -1;
break;
}
case G_TYPE_PARAM:
if (PyGParamSpec_Check(obj))
- g_value_set_param(value, PyCObject_AsVoidPtr(obj));
+ g_value_set_param(value, PYGLIB_CPointer_GetPointer(obj, NULL));
else
return -1;
break;
--
1.7.2.3

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5554acff9c27b647144143b0459359864e4a6f2ff62c7ba21cf310ad755cf7c7
size 808427

3
pygobject-2.28.4.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:70e3a05dd5f688e68b5dafa2412cd4fdbc0af83792a5752ef6353c4accf2022c
size 882762

View File

@ -1,6 +1,94 @@
-------------------------------------------------------------------
Wed Feb 9 18:09:19 UTC 2011 - jmatejek@novell.com
Wed May 4 16:26:18 UTC 2011 - dimstar@opensuse.org
- Update to version 2.28.4:
+ [gi] Don't create variant twice
+ [gi] Removed hack to avoid using GLib.Variant.new_variant.
+ [gi] Added additional test case for GVariant handling
+ [gi] Added support for GVariant arguments
+ pygi-convert.sh: Make sure the uppercase GObject module is
imported instead of the lowercase
+ Fix ABI break in old static bindings
+ Fetch size from an enum type
+ dsextras.py: ensure eol characters are preserved when writing
template files (so \n does not become \r\n)
- Use full URL to tarball as Source: tag.
-------------------------------------------------------------------
Wed Mar 23 17:39:40 UTC 2011 - fcrozat@novell.com
- Update to version 2.28.3:
+ fix a typo when converting objects to strings gvalues
- Changes from version 2.28.2:
+ fixed an ABI break in the static bindings when setting string
gvalues e.g. passing an int to a Gtk.ListStore column which
expects a string automatically converts the int to a string
instead of throwing an error.
- Changes from version 2.28.1:
+ pygi-convert.sh now supports webkit conversions and favors
using GObject over gobject.
+ Raw closures can now be passed from a signal/vfunc callback to
a method.
+ Revert linking to the python libs because the python runtime
statically links it in TreeModel column marshalling is now more
robust (supports GObject Python Object storing).
+ Gtk.MessageDialog now respects the MessageType
+ You can now send None in for the signature of GDBus messages
that have no parameters.
+ TreeViewColumn.set_cell_data_func can take None for the func_data
+ Fix syntax error so we can run in Python 2.5
+ Add pickers and menu demos
- Changes from version 2.28.0:
+ fix sinking of floating objects
+ fix leaks when setting properties
+ add basic icon view demo
+ add search entry demo
+ override Gdk.RGBA so you can construct it like
Gdk.RGBA(1.0, 1.0, 1.0, 1.0).
+ handle unichar gvalues in TreeModels
+ check for _thread module when configuring threading
+ package config file now contains overridesdir variable for 3rd
party overrides.
+ on windows set bdist_wininst user-access-control property when
installing.
+ Gtk.stock_lookup return None on failure instead of a success
value.
+ Python 2.5 fixes
+ Python 3 fixes
-------------------------------------------------------------------
Tue Mar 1 08:30:34 UTC 2011 - fcrozat@novell.com
- Update to version 2.27.91:
+ Typelibs now loaded at import time instead of lazy loading.
+ Various fixes for GTK+/GDK support via gi.
+ Various other fixes.
- Changes from version 2.27.90:
+ Faster handling of virtual methods when constructing objects
+ Enhanced gdbus and gvarient handling.
+ Enhanced drag and drop support.
+ Enhanced GtkTextBuffer support
+ Enhanced pygi-convert.sh script for automating PyGtk to
PyGObject Introspection migration.
+ Many introspection fixes.
+ Add/improve various overrides for GTK+.
+ Python 3 fixes.
- Changes from version 2.27.0:
+ Implement richcompare for GIBaseInfo
+ Add a overrides registry so we can reference overrides inside
the module
+ Add/improve various overrides for GTK+.
+ Many introspection fixes.
+ Python 3 fixes.
+ Various other fixes.
- Remove pygobject-2.26.0-capsule.patch: fixed upstream.
- Change python-gobject2, python-gobject2-cairo and
python-gobject2-devel Obsoletes to be < instead of <= now that we
have a new version.
-------------------------------------------------------------------
-Wed Feb 9 18:09:19 UTC 2011 - jmatejek@novell.com
- added patch that switches to new Capsule API, because the deprecated
PyCObject API will cause a segfault when warnings are exceptions
(bnc#669802)

View File

@ -21,15 +21,12 @@
Name: python-gobject
%define _name pygobject
Summary: Python bindings for GObject
Version: 2.26.0
Release: 2
# NOTE: on upgrade to a new upstream version (after 2.26.0), change the various Obsoletes from <= to <
Version: 2.28.4
Release: 1
License: LGPLv2.1+
Group: Development/Libraries/Python
Url: http://ftp.gnome.org/pub/GNOME/sources/pygobject/
Source: %{_name}-%{version}.tar.bz2
# conditionally use the new Capsule API instead of PyCObject, bnc#669802
Patch0: pygobject-2.26.0-capsule.patch
Source: http://ftp.gnome.org/pub/GNOME/sources/pygobject/2.28/%{_name}-%{version}.tar.bz2
BuildRequires: fdupes
BuildRequires: glib2-devel
BuildRequires: gobject-introspection-devel
@ -38,8 +35,7 @@ BuildRequires: python-cairo-devel
# BuildRequires: libffi-devel
BuildRequires: python-devel
Provides: python-gobject2 = %{version}
# Note: we keep <= (and a rpmlint warning...) until we get a version higher than 2.26.0 (when this provides/obsoletes was introduced)
Obsoletes: python-gobject2 <= %{version}
Obsoletes: python-gobject2 < %{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{py_requires}
@ -53,8 +49,7 @@ Summary: Python bindings for GObject -- Cairo bindings
Group: Development/Libraries/Python
Requires: %{name} = %{version}
Provides: python-gobject2-cairo = %{version}
# Note: we keep <= (and a rpmlint warning...) until we get a version higher than 2.26.0 (when this provides/obsoletes was introduced)
Obsoletes: python-gobject2-cairo <= %{version}
Obsoletes: python-gobject2-cairo < %{version}
%define cairo_real_package %(rpm -q --qf '%{NAME}' --whatprovides cairo)
Supplements: packageand(%{name}:%{cairo_real_package})
@ -70,8 +65,7 @@ Summary: Python bindings for GObject
Group: Development/Libraries/Python
Requires: %{name} = %{version} glib2-devel
Provides: python-gobject2-devel = %{version}
# Note: we keep <= (and a rpmlint warning...) until we get a version higher than 2.26.0 (when this provides/obsoletes was introduced)
Obsoletes: python-gobject2-devel <= %{version}
Obsoletes: python-gobject2-devel < %{version}
Provides: python-gobject2-doc = %{version}
Obsoletes: python-gobject2-doc < %{version}
@ -81,11 +75,10 @@ addon libraries such as pygtk.
%prep
%setup -q -n %{_name}-%{version}
%patch0 -p1
%build
%configure
make %{?jobs:-j%jobs}
make %{?jobs:-j%jobs} V=1
%install
%makeinstall
@ -104,19 +97,19 @@ rm -rf $RPM_BUILD_ROOT
%defattr(-,root,root)
%doc AUTHORS NEWS README ChangeLog examples
%dir %{py_sitedir}/gtk-2.0
%{py_sitedir}/gtk-2.0/gi/
%{py_sitedir}/gi/
%{py_sitedir}/gtk-2.0/gio/
%{py_sitedir}/gtk-2.0/glib/
%{py_sitedir}/gtk-2.0/gobject/
%{py_sitedir}/glib/
%{py_sitedir}/gobject/
%{py_sitedir}/gtk-2.0/dsextras.py*
%{py_sitedir}/pygtk.*
%{_libdir}/*.so.*
# Live in cairo subpackage
%exclude %{py_sitedir}/gtk-2.0/gi/_gi_cairo.so
%exclude %{py_sitedir}/gi/_gi_cairo.so
%files cairo
%defattr(-,root,root)
%{py_sitedir}/gtk-2.0/gi/_gi_cairo.so
%{py_sitedir}/gi/_gi_cairo.so
%files devel
%defattr(-,root,root)