summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2025-02-04 07:56:39 +0000
committerCoprDistGit <infra@openeuler.org>2025-02-04 07:56:39 +0000
commit8c1cbe25d38ba9198be10751231aac93089916b1 (patch)
tree4946ca8a80bb5839dcd19829c6b3f52dbba753fb
parent40c70d2d420426025bf282e2b023b9cb47233ec6 (diff)
automatic import of pygobject3openeuler24.03_LTS_SP1openeuler24.03_LTS
-rw-r--r--0001-revert-override-of-connection.register_object.patch140
-rw-r--r--367.patch42
-rw-r--r--pygobject3.spec8
3 files changed, 190 insertions, 0 deletions
diff --git a/0001-revert-override-of-connection.register_object.patch b/0001-revert-override-of-connection.register_object.patch
new file mode 100644
index 0000000..d80c18c
--- /dev/null
+++ b/0001-revert-override-of-connection.register_object.patch
@@ -0,0 +1,140 @@
+From e86c32092e693ecffcec211133fd1929603948d1 Mon Sep 17 00:00:00 2001
+From: Adam Williamson <awilliam@redhat.com>
+Date: Sat, 30 Nov 2024 14:59:49 -0800
+Subject: [PATCH] revert override of connection.register_object
+
+This seems to break the exit handler of anaconda (Fedora/RHEL
+installer), such that it often fails to exit properly.
+
+Signed-off-by: Adam Williamson <awilliam@redhat.com>
+---
+ gi/overrides/Gio.py | 31 -------------------
+ tests/test_gdbus.py | 73 ---------------------------------------------
+ 2 files changed, 104 deletions(-)
+
+diff --git a/gi/overrides/Gio.py b/gi/overrides/Gio.py
+index 48c3737a..45256385 100644
+--- a/gi/overrides/Gio.py
++++ b/gi/overrides/Gio.py
+@@ -89,37 +89,6 @@ class DBusArgInfo(Gio.DBusArgInfo):
+ __all__.append('DBusArgInfo')
+
+
+-@override
+-class DBusConnection(Gio.DBusConnection):
+- __init__ = _warn_init(Gio.DBusConnection)
+-
+- def register_object(self,
+- object_path,
+- interface_info,
+- method_call_closure=None,
+- get_property_closure=None,
+- set_property_closure=None):
+- if method_call_closure is not None:
+- def wrapped_method_call_closure(connection, sender, object_path,
+- interface_name, method_name, parameters,
+- invocation):
+- method_call_closure(connection, sender, object_path,
+- interface_name, method_name, parameters,
+- invocation)
+- invocation._unref()
+- else:
+- wrapped_method_call_closure = None
+-
+- return super().register_object(object_path,
+- interface_info,
+- wrapped_method_call_closure,
+- get_property_closure,
+- set_property_closure)
+-
+-
+-__all__.append('DBusConnection')
+-
+-
+ @override
+ class DBusMethodInfo(Gio.DBusMethodInfo):
+ __init__ = _warn_init(Gio.DBusMethodInfo)
+diff --git a/tests/test_gdbus.py b/tests/test_gdbus.py
+index afbf94cb..18fd0e41 100644
+--- a/tests/test_gdbus.py
++++ b/tests/test_gdbus.py
+@@ -284,76 +284,3 @@ class TestDBusConnection:
+ ):
+ reg_id = bus.register_object(**kwargs)
+ bus.unregister_object(reg_id)
+-
+- @unittest.skipUnless(has_dbus, "no dbus running")
+- def test_connection_invocation_ref_count(self):
+- """Invocation object should not leak a reference."""
+- invocation, errors = self.run_server(self.client_call)
+-
+- assert not errors
+- assert invocation
+- assert invocation.ref_count == 1
+-
+- def run_server(self, client_callback):
+- self.invocation = None
+- self.errors = []
+- self.loop = GLib.MainLoop()
+-
+- def on_name_acquired(bus, name):
+- client_callback(bus)
+-
+- self.reg_id = None
+- bus = Gio.bus_get_sync(Gio.BusType.SESSION)
+- owner_id = Gio.bus_own_name(Gio.BusType.SESSION,
+- "org.pygobject.Test",
+- Gio.BusNameOwnerFlags.NONE,
+- self.on_bus_acquired,
+- on_name_acquired,
+- self.on_name_lost)
+- try:
+- self.loop.run()
+- finally:
+- Gio.bus_unown_name(owner_id)
+- if self.reg_id:
+- bus.unregister_object(self.reg_id)
+-
+- return (self.invocation, self.errors)
+-
+- def on_name_lost(self, _bus, name):
+- self.errors.append(f"Name {name} lost")
+- self.loop.quit()
+-
+- def on_bus_acquired(self, bus, name):
+- interface_xml = """
+- <node>
+- <interface name='org.pygobject.Test'>
+- <method name='test' />
+- </interface>
+- </node>"""
+- self.reg_id = bus.register_object("/pygobject/Test",
+- Gio.DBusNodeInfo.new_for_xml(interface_xml).interfaces[0],
+- self.on_incoming_method_call,
+- None,
+- None)
+-
+- def on_incoming_method_call(self, bus, sender, object_path, interface_name, method_name, parameters, invocation):
+- invocation.return_value(GLib.Variant("()", ()))
+- self.invocation = invocation
+-
+- def client_call(self, bus):
+-
+- def call_done(obj, result):
+- try:
+- obj.call_finish(result)
+- finally:
+- self.loop.quit()
+-
+- bus.call("org.pygobject.Test",
+- "/pygobject/Test",
+- "org.pygobject.Test",
+- "test",
+- parameters=None,
+- reply_type=None,
+- flags=Gio.DBusCallFlags.NONE,
+- timeout_msec=5000,
+- callback=call_done)
+--
+2.47.0
+
diff --git a/367.patch b/367.patch
new file mode 100644
index 0000000..8306c6f
--- /dev/null
+++ b/367.patch
@@ -0,0 +1,42 @@
+From a2445df58a712980ccd0c21d75a631c6bda89b2b Mon Sep 17 00:00:00 2001
+From: Simon McVittie <smcv@debian.org>
+Date: Wed, 23 Oct 2024 12:01:24 +0100
+Subject: [PATCH] async: Use correct T_BOOL type for _asyncio_future_blocking
+
+Declaring a PyMemberDef with type T_BOOL requires the corresponding C
+type to be char, with value 0 or 1: when the member is read, CPython
+will effectively be dereferencing
+`* (char *) &pygiasync._asyncio_future_blocking`.
+
+On little-endian architectures, in practice this worked, because the
+low-order bits of an int are in the first byte, which would take value
+0 or 1 as desired, with all other bits zero. However, on big-endian
+architectures, the low-order bits of an int are in the last byte, so
+reading the _asyncio_future_blocking attribute from Python code would
+in practice always produce 0, even when the int field had been set to 1
+from C code.
+
+Reference: https://docs.python.org/3/c-api/structures.html#member-types
+Resolves: https://gitlab.gnome.org/GNOME/pygobject/-/issues/650
+Bug-Debian: https://bugs.debian.org/1085891
+Signed-off-by: Simon McVittie <smcv@debian.org>
+---
+ gi/pygi-async.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gi/pygi-async.h b/gi/pygi-async.h
+index d5e7a92a7..341d62377 100644
+--- a/gi/pygi-async.h
++++ b/gi/pygi-async.h
+@@ -37,7 +37,7 @@ typedef struct {
+ PyGICallableInfo *finish_func;
+ PyObject *loop;
+ PyObject *cancellable;
+- int _asyncio_future_blocking;
++ char _asyncio_future_blocking;
+ PyObject *result;
+ PyObject *exception;
+
+--
+GitLab
+
diff --git a/pygobject3.spec b/pygobject3.spec
index 2df701f..803412d 100644
--- a/pygobject3.spec
+++ b/pygobject3.spec
@@ -12,6 +12,14 @@ Source0: https://download.gnome.org/sources/pygobject/3.50/pygobject-%{v
# Drop GIMarshallingTests - It's test suite remainders that should not be installed
Patch0: pygobject-do-not-install-GIMarshallingTests.patch
+# async: Use correct T_BOOL type for _asyncio_future_blocking (merged upstream)
+# Fixes failures on s390x
+Patch1: https://gitlab.gnome.org/GNOME/pygobject/-/merge_requests/367.patch
+# https://bugzilla.redhat.com/show_bug.cgi?id=2329587
+# https://gitlab.gnome.org/GNOME/pygobject/-/issues/658
+# Revert override of connection.register_object to avoid breaking anaconda
+Patch2: 0001-revert-override-of-connection.register_object.patch
+
BuildRequires: meson >= 0.64.0
BuildRequires: pkgconfig(cairo)
BuildRequires: pkgconfig(cairo-gobject)