Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
ff088ad3ed | ||
|
4f84db6ac5 | ||
|
ebfddf2c7d | ||
|
112281f73e | ||
|
01135f89b9 | ||
|
33f57c65e0 | ||
|
14e44ae561 | ||
|
6617c26f33 | ||
|
d6dc320bb7 | ||
|
986308e848 | ||
|
4037de6069 | ||
|
fb17c9a813 |
102
fix-rhythmbox.patch
Normal file
102
fix-rhythmbox.patch
Normal file
@ -0,0 +1,102 @@
|
||||
From 69c671ec984e7592afbd86b33e38fb8095b7f4f1 Mon Sep 17 00:00:00 2001
|
||||
From: Ray Strode <rstrode@redhat.com>
|
||||
Date: Wed, 19 Dec 2012 13:04:32 -0500
|
||||
Subject: [PATCH] pyg_value_from_pyobject: support GArray
|
||||
|
||||
This commit adds support for marshalling
|
||||
a python list (or other sequence) returned
|
||||
from signal handlers to GArray, if necessary.
|
||||
|
||||
This parallels the implementation written
|
||||
to marshal to (the now deprecated) GValueArray.
|
||||
|
||||
This fixes a crash in rhythmbox as seen downstream here:
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=872851
|
||||
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=690514
|
||||
---
|
||||
gi/_gobject/pygtype.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 60 insertions(+)
|
||||
|
||||
diff --git a/gi/_gobject/pygtype.c b/gi/_gobject/pygtype.c
|
||||
index c803db3..b57d829 100644
|
||||
--- a/gi/_gobject/pygtype.c
|
||||
+++ b/gi/_gobject/pygtype.c
|
||||
@@ -727,6 +727,63 @@ pyg_value_array_from_pyobject(GValue *value,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int
|
||||
+pyg_array_from_pyobject(GValue *value,
|
||||
+ PyObject *obj)
|
||||
+{
|
||||
+ int len;
|
||||
+ GArray *array;
|
||||
+ int i;
|
||||
+
|
||||
+ len = PySequence_Length(obj);
|
||||
+ if (len == -1) {
|
||||
+ PyErr_Clear();
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ array = g_array_new(FALSE, TRUE, sizeof(GValue));
|
||||
+
|
||||
+ for (i = 0; i < len; ++i) {
|
||||
+ PyObject *item = PySequence_GetItem(obj, i);
|
||||
+ GType type;
|
||||
+ GValue item_value = { 0, };
|
||||
+ int status;
|
||||
+
|
||||
+ if (! item) {
|
||||
+ PyErr_Clear();
|
||||
+ g_array_free(array, FALSE);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (item == Py_None)
|
||||
+ type = G_TYPE_POINTER; /* store None as NULL */
|
||||
+ else {
|
||||
+ type = pyg_type_from_object((PyObject*)Py_TYPE(item));
|
||||
+ if (! type) {
|
||||
+ PyErr_Clear();
|
||||
+ g_array_free(array, FALSE);
|
||||
+ Py_DECREF(item);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ g_value_init(&item_value, type);
|
||||
+ status = pyg_value_from_pyobject(&item_value, item);
|
||||
+ Py_DECREF(item);
|
||||
+
|
||||
+ if (status == -1) {
|
||||
+ g_array_free(array, FALSE);
|
||||
+ g_value_unset(&item_value);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ g_array_append_val(array, item_value);
|
||||
+ }
|
||||
+
|
||||
+ g_value_take_boxed(value, array);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static
|
||||
PyObject *
|
||||
pyg_get_gvariant_type()
|
||||
@@ -979,6 +1036,9 @@ pyg_value_from_pyobject(GValue *value, PyObject *obj)
|
||||
else if (PySequence_Check(obj) &&
|
||||
G_VALUE_HOLDS(value, G_TYPE_VALUE_ARRAY))
|
||||
return pyg_value_array_from_pyobject(value, obj, NULL);
|
||||
+ else if (PySequence_Check(obj) &&
|
||||
+ G_VALUE_HOLDS(value, G_TYPE_ARRAY))
|
||||
+ return pyg_array_from_pyobject(value, obj);
|
||||
else if (PYGLIB_PyUnicode_Check(obj) &&
|
||||
G_VALUE_HOLDS(value, G_TYPE_GSTRING)) {
|
||||
GString *string;
|
||||
--
|
||||
1.8.0.2
|
||||
|
74
gdk-atom-1.patch
Normal file
74
gdk-atom-1.patch
Normal file
@ -0,0 +1,74 @@
|
||||
From c69fca1cd401bb6c9cf360076dc3027979a18cd9 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Pitt <martinpitt@gnome.org>
|
||||
Date: Tue, 13 Nov 2012 12:56:11 +0100
|
||||
Subject: [PATCH 1/3] Fix Gdk.Atom to have a proper str() and repr()
|
||||
|
||||
Gdk.Atom is not proper GType'd class, so we cannot override the whole class.
|
||||
Just override its __str__() and __repr__() methods so that printing atoms shows
|
||||
something sensible. For nameless/invalid atoms, fall back to the old
|
||||
<void at 0xdeadbeef> output to help with debugging.
|
||||
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=678620
|
||||
---
|
||||
gi/overrides/Gdk.py | 21 +++++++++++++++++++++
|
||||
tests/test_atoms.py | 12 ++++++++++++
|
||||
2 files changed, 33 insertions(+)
|
||||
|
||||
diff --git a/gi/overrides/Gdk.py b/gi/overrides/Gdk.py
|
||||
index 20ef910..0571c40 100644
|
||||
--- a/gi/overrides/Gdk.py
|
||||
+++ b/gi/overrides/Gdk.py
|
||||
@@ -345,6 +345,27 @@ def color_parse(color):
|
||||
return None
|
||||
return color
|
||||
|
||||
+
|
||||
+# Note, we cannot override the entire class as Gdk.Atom has no gtype, so just
|
||||
+# hack some individual methods
|
||||
+def _gdk_atom_str(atom):
|
||||
+ n = atom.name()
|
||||
+ if n:
|
||||
+ return n
|
||||
+ return Gdk.Atom.__str__(n)
|
||||
+
|
||||
+
|
||||
+def _gdk_atom_repr(atom):
|
||||
+ n = atom.name()
|
||||
+ if n:
|
||||
+ return 'Gdk.Atom<%s>' % n
|
||||
+ return Gdk.Atom.__str__(n)
|
||||
+
|
||||
+
|
||||
+Gdk.Atom.__str__ = _gdk_atom_str
|
||||
+Gdk.Atom.__repr__ = _gdk_atom_repr
|
||||
+
|
||||
+
|
||||
# constants
|
||||
if Gdk._version >= '3.0':
|
||||
SELECTION_PRIMARY = Gdk.atom_intern('PRIMARY', True)
|
||||
diff --git a/tests/test_atoms.py b/tests/test_atoms.py
|
||||
index a59d15a..449fcda 100644
|
||||
--- a/tests/test_atoms.py
|
||||
+++ b/tests/test_atoms.py
|
||||
@@ -13,6 +13,18 @@ class TestGdkAtom(unittest.TestCase):
|
||||
atom = Gdk.Atom.intern('my_string', False)
|
||||
self.assertEqual(atom.name(), 'my_string')
|
||||
|
||||
+ def test_str(self):
|
||||
+ atom = Gdk.Atom.intern('my_string', False)
|
||||
+ self.assertEqual(str(atom), 'my_string')
|
||||
+
|
||||
+ self.assertEqual(str(Gdk.SELECTION_CLIPBOARD), 'CLIPBOARD')
|
||||
+
|
||||
+ def test_repr(self):
|
||||
+ atom = Gdk.Atom.intern('my_string', False)
|
||||
+ self.assertEqual(repr(atom), 'Gdk.Atom<my_string>')
|
||||
+
|
||||
+ self.assertEqual(repr(Gdk.SELECTION_CLIPBOARD), 'Gdk.Atom<CLIPBOARD>')
|
||||
+
|
||||
def test_in_single(self):
|
||||
a_selection = Gdk.Atom.intern('test_clipboard', False)
|
||||
clipboard = Gtk.Clipboard.get(a_selection)
|
||||
--
|
||||
1.7.11.7
|
||||
|
38
gdk-atom-2.patch
Normal file
38
gdk-atom-2.patch
Normal file
@ -0,0 +1,38 @@
|
||||
From 0e7aec1bc5555b05b67da63176312eb51460b9ee Mon Sep 17 00:00:00 2001
|
||||
From: Martin Pitt <martinpitt@gnome.org>
|
||||
Date: Tue, 13 Nov 2012 16:38:36 +0100
|
||||
Subject: [PATCH 2/3] Fix Gdk.Atom str()/repr() fallback
|
||||
|
||||
Fix regression in commit 6713618: If an atom does not have a name, do not
|
||||
recursively call our own str()/repr() methods, but just print
|
||||
"Gdk.Atom<atom_id>".
|
||||
---
|
||||
gi/overrides/Gdk.py | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gi/overrides/Gdk.py b/gi/overrides/Gdk.py
|
||||
index 0571c40..63f1467 100644
|
||||
--- a/gi/overrides/Gdk.py
|
||||
+++ b/gi/overrides/Gdk.py
|
||||
@@ -352,14 +352,16 @@ def _gdk_atom_str(atom):
|
||||
n = atom.name()
|
||||
if n:
|
||||
return n
|
||||
- return Gdk.Atom.__str__(n)
|
||||
+ # fall back to atom index
|
||||
+ return 'Gdk.Atom<%i>' % hash(atom)
|
||||
|
||||
|
||||
def _gdk_atom_repr(atom):
|
||||
n = atom.name()
|
||||
if n:
|
||||
return 'Gdk.Atom<%s>' % n
|
||||
- return Gdk.Atom.__str__(n)
|
||||
+ # fall back to atom index
|
||||
+ return 'Gdk.Atom<%i>' % hash(atom)
|
||||
|
||||
|
||||
Gdk.Atom.__str__ = _gdk_atom_str
|
||||
--
|
||||
1.7.11.7
|
||||
|
@ -21,8 +21,8 @@
|
||||
### Abstract ###
|
||||
|
||||
Name: pygobject3
|
||||
Version: 3.4.1.1
|
||||
Release: 2%{?dist}
|
||||
Version: 3.4.2
|
||||
Release: 6%{?dist}
|
||||
License: LGPLv2+ and MIT
|
||||
Group: Development/Languages
|
||||
Summary: Python 2 bindings for GObject Introspection
|
||||
@ -72,8 +72,25 @@ Patch3: test-list-marshalling.patch
|
||||
# upstream fix for property type lookup, needed for basic Sugar operation
|
||||
Patch4: property-lookup.patch
|
||||
|
||||
# upstream fixes for Gdk.Atom
|
||||
Patch5: gdk-atom-1.patch
|
||||
Patch6: gdk-atom-2.patch
|
||||
|
||||
# upstream fix for arrays of struct pointers
|
||||
Patch7: struct-pointers.patch
|
||||
|
||||
# https://bugzilla.gnome.org/show_bug.cgi?id=690514
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=872851
|
||||
# rhythmbox crash
|
||||
Patch8: fix-rhythmbox.patch
|
||||
|
||||
# upstream fix for array of boxed struct values
|
||||
# https://bugzilla.gnome.org/show_bug.cgi?id=656312
|
||||
Patch9: structarray.patch
|
||||
|
||||
### Build Dependencies ###
|
||||
|
||||
BuildRequires: chrpath
|
||||
BuildRequires: glib2-devel >= %{glib2_version}
|
||||
BuildRequires: gobject-introspection-devel >= %{gobject_introspection_version}
|
||||
BuildRequires: python2-devel >= %{python2_version}
|
||||
@ -102,15 +119,24 @@ BuildRequires: dejavu-serif-fonts
|
||||
BuildRequires: dbus-x11
|
||||
%endif # with_check
|
||||
|
||||
Requires: %{name}-base = %{version}-%{release}
|
||||
|
||||
# The cairo override module depends on this
|
||||
Requires: pycairo
|
||||
|
||||
Requires: gobject-introspection >= %{gobject_introspection_version}
|
||||
|
||||
%description
|
||||
The %{name} package provides a convenient wrapper for the GObject library
|
||||
for use in Python programs.
|
||||
|
||||
%package base
|
||||
Summary: Python 2 bindings for GObject Introspection base package
|
||||
Group: Development/Languages
|
||||
Requires: gobject-introspection >= %{gobject_introspection_version}
|
||||
|
||||
%description base
|
||||
This package provides the non-cairo specific bits of the GObject Introspection
|
||||
library.
|
||||
|
||||
%package devel
|
||||
Summary: Development files for embedding PyGObject introspection support
|
||||
Group: Development/Languages
|
||||
@ -144,6 +170,11 @@ for use in Python 3 programs.
|
||||
%patch2 -p1 -b .known-failures
|
||||
%patch3 -p1 -b .test-list-marshalling
|
||||
%patch4 -p1 -b .property-lookup
|
||||
%patch5 -p1 -b .atom1
|
||||
%patch6 -p1 -b .atom2
|
||||
%patch7 -p1 -b .struct-pointers
|
||||
%patch8 -p1 -b .fix-rhythmbox
|
||||
%patch9 -p1 -b .boxed-struct
|
||||
|
||||
%if 0%{?with_python3}
|
||||
rm -rf %{py3dir}
|
||||
@ -178,12 +209,23 @@ export PYTHON
|
||||
make DESTDIR=$RPM_BUILD_ROOT install %{verbosity}
|
||||
popd
|
||||
|
||||
chrpath --delete $RPM_BUILD_ROOT%{python3_sitearch}/gi/{*.so,*/*.so}
|
||||
|
||||
%endif # with_python3
|
||||
|
||||
make DESTDIR=$RPM_BUILD_ROOT install %{verbosity}
|
||||
find $RPM_BUILD_ROOT -name '*.la' -delete
|
||||
find $RPM_BUILD_ROOT -name '*.a' -delete
|
||||
|
||||
chrpath --delete $RPM_BUILD_ROOT%{python_sitearch}/gi/{*.so,*/*.so}
|
||||
|
||||
# Don't include makefiles in the installed docs, in order to avoid creating
|
||||
# multilib conflicts
|
||||
rm -rf _docs
|
||||
mkdir _docs
|
||||
cp -a examples _docs
|
||||
rm _docs/examples/Makefile*
|
||||
|
||||
%check
|
||||
|
||||
%if %{with_check}
|
||||
@ -214,16 +256,20 @@ xvfb-run make DESTDIR=$RPM_BUILD_ROOT check %{verbosity}
|
||||
|
||||
%files
|
||||
%defattr(644, root, root, 755)
|
||||
%doc AUTHORS NEWS README COPYING
|
||||
%doc examples
|
||||
%{python_sitearch}/gi/_gi_cairo.so
|
||||
|
||||
%files base
|
||||
%defattr(644, root, root, 755)
|
||||
%doc AUTHORS NEWS README COPYING
|
||||
%{_libdir}/libpyglib-gi-2.0-python.so*
|
||||
%dir %{python_sitearch}/gi
|
||||
%{python_sitearch}/gi/*
|
||||
%exclude %{python_sitearch}/gi/_gi_cairo.so
|
||||
%{python_sitearch}/pygobject-*.egg-info
|
||||
|
||||
%files devel
|
||||
%defattr(644, root, root, 755)
|
||||
%doc _docs/*
|
||||
%dir %{_includedir}/pygobject-3.0/
|
||||
%{_includedir}/pygobject-3.0/pygobject.h
|
||||
%{_libdir}/pkgconfig/pygobject-3.0.pc
|
||||
@ -232,8 +278,6 @@ xvfb-run make DESTDIR=$RPM_BUILD_ROOT check %{verbosity}
|
||||
%files -n python3-gobject
|
||||
%defattr(644, root, root, 755)
|
||||
%doc AUTHORS NEWS README COPYING
|
||||
%doc examples
|
||||
|
||||
%{_libdir}/libpyglib-gi-2.0-python3.so*
|
||||
%dir %{python3_sitearch}/gi
|
||||
%{python3_sitearch}/gi/*
|
||||
@ -242,6 +286,27 @@ xvfb-run make DESTDIR=$RPM_BUILD_ROOT check %{verbosity}
|
||||
%endif # with_python3
|
||||
|
||||
%changelog
|
||||
* Fri Dec 21 2012 Daniel Drake <dsd@laptop.org> 3.4.2-6
|
||||
- Another upstream fix for copy/paste functionality in sugar (gnome#656312)
|
||||
|
||||
* Wed Dec 19 2012 Ray Strode <rstrode@redhat.com> 3.4.2-5
|
||||
- Fix rhythmbox crash
|
||||
Resolves: #872851
|
||||
|
||||
* Thu Dec 13 2012 Ray Strode <rstrode@redhat.com> 3.4.2-4
|
||||
- Split non-cairo parts into a subpackage
|
||||
|
||||
* Mon Nov 26 2012 Daniel Drake <dsd@laptop.org> - 3.4.2-3
|
||||
- More upstream patches to fix copy/paste functionality in Sugar.
|
||||
|
||||
* Mon Nov 12 2012 Kalev Lember <kalevlember@gmail.com> - 3.4.2-2
|
||||
- Remove lib64 rpaths (#817701)
|
||||
- Move code examples to the -devel subpackage and fix the multilib
|
||||
conflict (#831434)
|
||||
|
||||
* Mon Nov 12 2012 Kalev Lember <kalevlember@gmail.com> - 3.4.2-1
|
||||
- Update to 3.4.2
|
||||
|
||||
* Tue Nov 6 2012 Daniel Drake <dsd@laptop.org> - 3.4.1.1-2
|
||||
- Upstream fix for property lookup; needed for basic Sugar operation.
|
||||
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
949cffe0ae8e13ac84794b04e2b58aeb pygobject-3.4.1.1.tar.xz
|
||||
a17b3897507f179d643e02f5abf111ac pygobject-3.4.2.tar.xz
|
||||
|
33
struct-pointers.patch
Normal file
33
struct-pointers.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From da049efee691fcf6f9d3cd6bb270ee11b3a34b65 Mon Sep 17 00:00:00 2001
|
||||
From: Carlos Garnacho <carlos@lanedo.com>
|
||||
Date: Tue, 13 Nov 2012 18:24:28 +0100
|
||||
Subject: [PATCH 3/3] Fix marshalling of arrays of struct pointers to Python
|
||||
|
||||
Fill in the pointer to the struct, not the pointer to the
|
||||
array position. This makes the GdkAtom** argument in
|
||||
gtk_clipboard_wait_for_targets() work.
|
||||
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=678620
|
||||
---
|
||||
gi/pygi-marshal-to-py.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gi/pygi-marshal-to-py.c b/gi/pygi-marshal-to-py.c
|
||||
index 811d8b0..950895d 100644
|
||||
--- a/gi/pygi-marshal-to-py.c
|
||||
+++ b/gi/pygi-marshal-to-py.c
|
||||
@@ -439,7 +439,10 @@ _pygi_marshal_to_py_array (PyGIInvokeState *state,
|
||||
memcpy (_struct, array_->data + i * item_size,
|
||||
item_size);
|
||||
item_arg.v_pointer = _struct;
|
||||
- } else
|
||||
+ } else if (item_arg_cache->is_pointer)
|
||||
+ /* this is the case for GAtom* arrays */
|
||||
+ item_arg.v_pointer = g_array_index (array_, gpointer, i);
|
||||
+ else
|
||||
item_arg.v_pointer = array_->data + i * item_size;
|
||||
break;
|
||||
default:
|
||||
--
|
||||
1.7.11.7
|
||||
|
30
structarray.patch
Normal file
30
structarray.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From 9454c01f2b1b82d43eea0f72fe9a28ef50065fc9 Mon Sep 17 00:00:00 2001
|
||||
From: Carlos Garnacho <carlos@lanedo.com>
|
||||
Date: Tue, 18 Dec 2012 21:47:09 +0000
|
||||
Subject: Fix marshalling of arrays of boxed struct values
|
||||
|
||||
This fixes methods like gtk_selection_set_with_data(). In such cases
|
||||
data is passed as an array of struct pointers, so it must be converted
|
||||
to an array of structs.
|
||||
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=656312
|
||||
|
||||
Co-Authored-By: Martin Pitt <martinpitt@gnome.org>
|
||||
---
|
||||
diff --git a/gi/pygi-marshal-from-py.c b/gi/pygi-marshal-from-py.c
|
||||
index dc14ca5..e842227 100644
|
||||
--- a/gi/pygi-marshal-from-py.c
|
||||
+++ b/gi/pygi-marshal-from-py.c
|
||||
@@ -1009,6 +1009,12 @@ _pygi_marshal_from_py_array (PyGIInvokeState *state,
|
||||
if (from_py_cleanup)
|
||||
from_py_cleanup (state, item_arg_cache, item.v_pointer, TRUE);
|
||||
}
|
||||
+ } else if (is_boxed && !item_iface_cache->arg_cache.is_pointer) {
|
||||
+ /* The array elements are not expected to be pointers, but the
|
||||
+ * elements obtained are boxed pointers themselves, so insert
|
||||
+ * the pointed to data.
|
||||
+ */
|
||||
+ g_array_insert_vals (array_, i, item.v_pointer, 1);
|
||||
} else {
|
||||
g_array_insert_val (array_, i, item);
|
||||
}
|
Loading…
Reference in New Issue
Block a user