r28781 - in /desktop/unstable/pygobject/debian: changelog patches/00git_cairo_init.patch patches/00git_enum_properties.patch patches/00git_textiter_crash.patch patches/series

mpitt at users.alioth.debian.org mpitt at users.alioth.debian.org
Fri Jul 8 09:53:55 UTC 2011


Author: mpitt
Date: Fri Jul  8 09:53:54 2011
New Revision: 28781

URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=28781
Log:
* Cherrypick some fixes from pygobject-2-28 upstream branch:
  - Add 00git_enum_properties.patch: Add support for enums in
    gobject.property
  - Add 00git_cairo_init.patch: Correctly initialize the _gi_cairo_functions
    array to be zero filled
  - 00git_textiter_crash.patch: Fix crash in Gtk.TextIter overrides

Added:
    desktop/unstable/pygobject/debian/patches/00git_cairo_init.patch
    desktop/unstable/pygobject/debian/patches/00git_enum_properties.patch
    desktop/unstable/pygobject/debian/patches/00git_textiter_crash.patch
Modified:
    desktop/unstable/pygobject/debian/changelog
    desktop/unstable/pygobject/debian/patches/series

Modified: desktop/unstable/pygobject/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/pygobject/debian/changelog?rev=28781&op=diff
==============================================================================
--- desktop/unstable/pygobject/debian/changelog [utf-8] (original)
+++ desktop/unstable/pygobject/debian/changelog [utf-8] Fri Jul  8 09:53:54 2011
@@ -1,3 +1,14 @@
+pygobject (2.28.6-2) UNRELEASED; urgency=low
+
+  * Cherrypick some fixes from pygobject-2-28 upstream branch:
+    - Add 00git_enum_properties.patch: Add support for enums in
+      gobject.property
+    - Add 00git_cairo_init.patch: Correctly initialize the _gi_cairo_functions
+      array to be zero filled
+    - 00git_textiter_crash.patch: Fix crash in Gtk.TextIter overrides
+
+ -- Martin Pitt <mpitt at debian.org>  Fri, 08 Jul 2011 09:54:25 +0200
+
 pygobject (2.28.6-1) unstable; urgency=low
 
   * New upstream bug fix release.

Added: desktop/unstable/pygobject/debian/patches/00git_cairo_init.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/pygobject/debian/patches/00git_cairo_init.patch?rev=28781&op=file
==============================================================================
--- desktop/unstable/pygobject/debian/patches/00git_cairo_init.patch (added)
+++ desktop/unstable/pygobject/debian/patches/00git_cairo_init.patch [utf-8] Fri Jul  8 09:53:54 2011
@@ -1,0 +1,26 @@
+From 9281ce8876ca5205c7cbe0a55eba94e7ea3fc10d Mon Sep 17 00:00:00 2001
+From: "John (J5) Palmieri" <johnp at redhat.com>
+Date: Fri, 1 Jul 2011 05:19:15 -0400
+Subject: [PATCH 3/4] correctly initialize the _gi_cairo_functions array to be
+ zero filled
+
+---
+ gi/pygi-foreign-cairo.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/gi/pygi-foreign-cairo.c b/gi/pygi-foreign-cairo.c
+index e332a22..81b9865 100644
+--- a/gi/pygi-foreign-cairo.c
++++ b/gi/pygi-foreign-cairo.c
+@@ -114,7 +114,7 @@ cairo_surface_release (GIBaseInfo *base_info,
+     Py_RETURN_NONE;
+ }
+ 
+-static PyMethodDef _gi_cairo_functions[] = {};
++static PyMethodDef _gi_cairo_functions[] = {0,};
+ PYGLIB_MODULE_START(_gi_cairo, "_gi_cairo")
+ {
+     Pycairo_IMPORT;
+-- 
+1.7.5.4
+

Added: desktop/unstable/pygobject/debian/patches/00git_enum_properties.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/pygobject/debian/patches/00git_enum_properties.patch?rev=28781&op=file
==============================================================================
--- desktop/unstable/pygobject/debian/patches/00git_enum_properties.patch (added)
+++ desktop/unstable/pygobject/debian/patches/00git_enum_properties.patch [utf-8] Fri Jul  8 09:53:54 2011
@@ -1,0 +1,143 @@
+From 71e7762e884d1dce82acbab4851c0436718c029a Mon Sep 17 00:00:00 2001
+From: Johan Dahlin <jdahlin at litl.com>
+Date: Mon, 27 Jun 2011 10:56:20 -0300
+Subject: [PATCH 1/4] Add support for enums in gobject.property
+
+https://bugzilla.gnome.org/show_bug.cgi?id=653488
+---
+ gobject/propertyhelper.py |   23 ++++++++++++++++-------
+ tests/test_properties.py  |   40 ++++++++++++++++++++++++++++++++++++----
+ 2 files changed, 52 insertions(+), 11 deletions(-)
+
+diff --git a/gobject/propertyhelper.py b/gobject/propertyhelper.py
+index 9643c82..b9b587a 100644
+--- a/gobject/propertyhelper.py
++++ b/gobject/propertyhelper.py
+@@ -188,14 +188,16 @@ class property(object):
+             return TYPE_STRING
+         elif type_ == object:
+             return TYPE_PYOBJECT
+-        elif isinstance(type_, type) and issubclass(type_, _gobject.GObject):
++        elif (isinstance(type_, type) and
++              issubclass(type_, (_gobject.GObject,
++                                 _gobject.GEnum))):
+             return type_.__gtype__
+         elif type_ in [TYPE_NONE, TYPE_INTERFACE, TYPE_CHAR, TYPE_UCHAR,
+-                      TYPE_INT, TYPE_UINT, TYPE_BOOLEAN, TYPE_LONG,
+-                      TYPE_ULONG, TYPE_INT64, TYPE_UINT64, TYPE_ENUM,
+-                      TYPE_FLAGS, TYPE_FLOAT, TYPE_DOUBLE, TYPE_POINTER,
+-                      TYPE_BOXED, TYPE_PARAM, TYPE_OBJECT, TYPE_STRING,
+-                      TYPE_PYOBJECT]:
++                       TYPE_INT, TYPE_UINT, TYPE_BOOLEAN, TYPE_LONG,
++                       TYPE_ULONG, TYPE_INT64, TYPE_UINT64,
++                       TYPE_FLOAT, TYPE_DOUBLE, TYPE_POINTER,
++                       TYPE_BOXED, TYPE_PARAM, TYPE_OBJECT, TYPE_STRING,
++                       TYPE_PYOBJECT]:
+             return type_
+         else:
+             raise TypeError("Unsupported type: %r" % (type_,))
+@@ -224,6 +226,12 @@ class property(object):
+         elif ptype == TYPE_PYOBJECT:
+             if default is not None:
+                 raise TypeError("object types does not have default values")
++        elif gobject.type_is_a(ptype, TYPE_ENUM):
++            if default is None:
++                raise TypeError("enum properties needs a default value")
++            elif not gobject.type_is_a(default, ptype):
++                raise TypeError("enum value %s must be an instance of %r" %
++                                (default, ptype))
+ 
+     def _get_minimum(self):
+         ptype = self.type
+@@ -291,7 +299,8 @@ class property(object):
+         if ptype in [TYPE_INT, TYPE_UINT, TYPE_LONG, TYPE_ULONG,
+                      TYPE_INT64, TYPE_UINT64, TYPE_FLOAT, TYPE_DOUBLE]:
+             args = self._get_minimum(), self._get_maximum(), self.default
+-        elif ptype == TYPE_STRING or ptype == TYPE_BOOLEAN:
++        elif (ptype == TYPE_STRING or ptype == TYPE_BOOLEAN or
++              ptype.is_a(TYPE_ENUM)):
+             args = (self.default,)
+         elif ptype == TYPE_PYOBJECT:
+             args = ()
+diff --git a/tests/test_properties.py b/tests/test_properties.py
+index 54afd11..74c1b38 100644
+--- a/tests/test_properties.py
++++ b/tests/test_properties.py
+@@ -14,6 +14,8 @@ from gobject.constants import \
+      G_MININT, G_MAXINT, G_MAXUINT, G_MINLONG, G_MAXLONG, \
+      G_MAXULONG
+ 
++import gio
++
+ if sys.version_info < (3, 0):
+     TEST_UTF8 = "\xe2\x99\xa5"
+     UNICODE_UTF8 = unicode(TEST_UTF8, 'UTF-8')
+@@ -34,6 +36,9 @@ class PropertyObject(GObject):
+     uint64 = gobject.property(
+         type=TYPE_UINT64, flags=PARAM_READWRITE|PARAM_CONSTRUCT)
+ 
++    enum = gobject.property(
++        type=gio.SocketType, default=gio.SOCKET_TYPE_STREAM)
++
+ class TestProperties(unittest.TestCase):
+     def testGetSet(self):
+         obj = PropertyObject()
+@@ -61,8 +66,9 @@ class TestProperties(unittest.TestCase):
+                 self.failUnless(pspec.name in ['normal',
+                                                'construct',
+                                                'construct-only',
+-                                               'uint64'])
+-            self.assertEqual(len(obj), 4)
++                                               'uint64',
++                                               'enum'])
++            self.assertEqual(len(obj), 5)
+ 
+     def testNormal(self):
+         obj = new(PropertyObject, normal="123")
+@@ -127,6 +133,34 @@ class TestProperties(unittest.TestCase):
+             (etype, ex) = sys.exc_info()[2:]
+             self.fail(str(ex))
+ 
++    def testEnum(self):
++        obj = new(PropertyObject)
++        self.assertEqual(obj.props.enum, gio.SOCKET_TYPE_STREAM)
++        self.assertEqual(obj.enum, gio.SOCKET_TYPE_STREAM)
++        obj.enum = gio.SOCKET_TYPE_DATAGRAM
++        self.assertEqual(obj.props.enum, gio.SOCKET_TYPE_DATAGRAM)
++        self.assertEqual(obj.enum, gio.SOCKET_TYPE_DATAGRAM)
++        obj.props.enum = gio.SOCKET_TYPE_STREAM
++        self.assertEqual(obj.props.enum, gio.SOCKET_TYPE_STREAM)
++        self.assertEqual(obj.enum, gio.SOCKET_TYPE_STREAM)
++        obj.props.enum = 2
++        self.assertEqual(obj.props.enum, gio.SOCKET_TYPE_DATAGRAM)
++        self.assertEqual(obj.enum, gio.SOCKET_TYPE_DATAGRAM)
++        obj.enum = 1
++        self.assertEqual(obj.props.enum, gio.SOCKET_TYPE_STREAM)
++        self.assertEqual(obj.enum, gio.SOCKET_TYPE_STREAM)
++
++        self.assertRaises(TypeError, setattr, obj, 'enum', 'foo')
++        self.assertRaises(TypeError, setattr, obj, 'enum', object())
++
++        self.assertRaises(TypeError, gobject.property, type=gio.SocketType)
++        self.assertRaises(TypeError, gobject.property, type=gio.SocketType,
++                          default=gio.SOCKET_PROTOCOL_TCP)
++        self.assertRaises(TypeError, gobject.property, type=gio.SocketType,
++                          default=object())
++        self.assertRaises(TypeError, gobject.property, type=gio.SocketType,
++                          default=1)
++
+     def testRange(self):
+         # kiwi code
+         def max(c):
+@@ -270,8 +304,6 @@ class TestProperty(unittest.TestCase):
+         # self.assertRaises(TypeError, gobject.property, type=bool, default=0)
+         self.assertRaises(TypeError, gobject.property, type=bool, default='ciao mamma')
+         self.assertRaises(TypeError, gobject.property, type=bool)
+-        self.assertRaises(TypeError, gobject.property, type=GEnum)
+-        self.assertRaises(TypeError, gobject.property, type=GEnum, default=0)
+         self.assertRaises(TypeError, gobject.property, type=object, default=0)
+         self.assertRaises(TypeError, gobject.property, type=complex)
+         self.assertRaises(TypeError, gobject.property, flags=-10)
+-- 
+1.7.5.4
+

Added: desktop/unstable/pygobject/debian/patches/00git_textiter_crash.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/pygobject/debian/patches/00git_textiter_crash.patch?rev=28781&op=file
==============================================================================
--- desktop/unstable/pygobject/debian/patches/00git_textiter_crash.patch (added)
+++ desktop/unstable/pygobject/debian/patches/00git_textiter_crash.patch [utf-8] Fri Jul  8 09:53:54 2011
@@ -1,0 +1,68 @@
+From e114c3de09d7d95942b308f704a6ca20244dad9d Mon Sep 17 00:00:00 2001
+From: Martin Pitt <martin.pitt at ubuntu.com>
+Date: Thu, 7 Jul 2011 13:39:19 +0200
+Subject: [PATCH 4/4] Fix crash in Gtk.TextIter overrides
+
+With commit 17cd0fb3 Gtk.TextIter.{forward,backward}_search() returns undefined
+pointers when the search was unsuccessful. Actually check the "success" return
+value; if it is False return None, just like PyGTK used to.
+
+Thanks to Michael Vogt for discovering this and writing the test case!
+
+Test case:
+
+-------------- 8< -----------------
+from gi.repository import Gtk
+
+win = Gtk.Window.new(Gtk.WindowType.TOPLEVEL)
+textview = Gtk.TextView()
+buffer = textview.get_buffer()
+buffer.set_text("hello world")
+win.add(textview)
+
+win.show_all()
+
+iter = buffer.get_start_iter()
+end = buffer.get_end_iter()
+ret = iter.forward_search("foo",
+                          Gtk.TextSearchFlags.VISIBLE_ONLY,
+			                            end)
+print "this is my return value"
+print ret
+print "now I crash"
+print ret[0].get_offset()
+
+Gtk.main()
+-------------- 8< -----------------
+---
+ gi/overrides/Gtk.py |   10 ++++++++--
+ 1 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
+index b7dd7d7..007e155 100644
+--- a/gi/overrides/Gtk.py
++++ b/gi/overrides/Gtk.py
+@@ -631,12 +631,18 @@ class TextIter(Gtk.TextIter):
+     def forward_search(self, string, flags, limit):
+         success, match_start, match_end = super(TextIter, self).forward_search(string,
+             flags, limit)
+-        return (match_start, match_end,)
++        if success:
++            return (match_start, match_end)
++        else:
++            return None
+ 
+     def backward_search(self, string, flags, limit):
+         success, match_start, match_end = super(TextIter, self).backward_search(string,
+             flags, limit)
+-        return (match_start, match_end,)
++        if success:
++            return (match_start, match_end)
++        else:
++            return None
+ 
+     def begins_tag(self, tag=None):
+         return super(TextIter, self).begins_tag(tag)
+-- 
+1.7.5.4
+

Modified: desktop/unstable/pygobject/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/pygobject/debian/patches/series?rev=28781&op=diff
==============================================================================
--- desktop/unstable/pygobject/debian/patches/series [utf-8] (original)
+++ desktop/unstable/pygobject/debian/patches/series [utf-8] Fri Jul  8 09:53:54 2011
@@ -1,1 +1,4 @@
+00git_enum_properties.patch
+00git_cairo_init.patch
+00git_textiter_crash.patch
 20_deprecated_spam.patch




More information about the pkg-gnome-commits mailing list