已合并
Fix Ggit override for pygobject 3.42+ compatibility #16
Funda Wang创建于 8月20日
Fix Ggit override for pygobject 3.42+ compatibility #16
已合并
Funda Wang创建于 8月20日
从已删除 :fix-ggit-override-module合入到src-openeuler/libgit2-glibmaster
共 2 个文件变更+53-3
@@ -0,0 +1,26 @@
1+From acc4c797de59919968b2fec2ff03a83fdd59fce6 Mon Sep 17 00:00:00 2001
2+From: Funda Wang <fundawang@yeah.net>
3+Date: Thu, 20 Aug 2026 09:54:01 +0800
4+Subject: [PATCH] Fix Ggit override for pygobject 3.42+ compatibility
5+ 
6+Set __module__ on dynamically created override classes in Ggit.py so
7+that gi.overrides.override() passes its module check.
8+ 
9+Co-Authored-By: AtomCode (deepseek-v4-flash) <noreply@atomgit.com>
10+---
11+ libgit2-glib/Ggit.py | 2 +-
12+ 1 file changed, 1 insertion(+), 1 deletion(-)
13+ 
14+diff --git a/libgit2-glib/Ggit.py b/libgit2-glib/Ggit.py
15+index 8422898..bbfb778 100644
16+--- a/libgit2-glib/Ggit.py
17++++ b/libgit2-glib/Ggit.py
18+@@ -57,7 +57,7 @@ def _override_dyn(base, **kwargs):
19+ cls = globals()[name]
20+
21+ except KeyError:
22+- cls = override(type(name, (base,), {}))
23++ cls = override(type(name, (base,), {'__module__': 'gi.overrides.Ggit'}))
24+ globals()[name] = cls
25+ __all__.append(name)
26+
@@ -1,13 +1,18 @@
1%global libgit2_version 0.25.01%global libgit2_version 0.25.0
2%global glib2_version 2.44.02%global glib2_version 2.44.0
3+# Do not scan the Ggit overrides for automatic python dependencies: only
4+# consumers that actually use the Python bindings (e.g. lorax-composer)
5+# need python-gi, not C library consumers.
6+%global __requires_exclude_from ^%{python3_sitearch}/gi/overrides/.*$
3 7 
4Name: libgit2-glib8Name: libgit2-glib
5Version: 1.2.19Version: 1.2.1
6-Release: 210+Release: 3
7Summary: Git library for GLib11Summary: Git library for GLib
8License: LGPL-2.1-or-later12License: LGPL-2.1-or-later
9URL: https://wiki.gnome.org/Projects/Libgit2-glib13URL: https://wiki.gnome.org/Projects/Libgit2-glib
10Source0: https://download.gnome.org/sources/libgit2-glib/1.2/libgit2-glib-%{version}.tar.xz14Source0: https://download.gnome.org/sources/libgit2-glib/1.2/libgit2-glib-%{version}.tar.xz
15+Patch0: 0001-fix-Ggit-override-module.patch
11BuildRequires: meson >= 0.61.016BuildRequires: meson >= 0.61.0
12BuildRequires: pkgconfig(gio-2.0) >= %{glib2_version}17BuildRequires: pkgconfig(gio-2.0) >= %{glib2_version}
13BuildRequires: pkgconfig(glib-2.0) >= %{glib2_version}18BuildRequires: pkgconfig(glib-2.0) >= %{glib2_version}
@@ -15,12 +20,12 @@ BuildRequires: pkgconfig(gobject-2.0) >= %{glib2_version}
15BuildRequires: pkgconfig(libgit2) >= 0.25.020BuildRequires: pkgconfig(libgit2) >= 0.25.0
16BuildRequires: pkgconfig(libssh2)21BuildRequires: pkgconfig(libssh2)
17BuildRequires: pkgconfig(pygobject-3.0) >= 3.0.022BuildRequires: pkgconfig(pygobject-3.0) >= 3.0.0
23+BuildRequires: python3-gobject-base
18BuildRequires: gi-docgen24BuildRequires: gi-docgen
19BuildRequires: vala25BuildRequires: vala
20BuildRequires: /usr/bin/g-ir-scanner26BuildRequires: /usr/bin/g-ir-scanner
21Requires: glib2 >= %{glib2_version}27Requires: glib2 >= %{glib2_version}
22-Requires: libgit2 >= %(rpm -q --queryformat="%%{VERSION}" libgit2)28+Requires: libgit2 >= %{installed_version_of libgit2}
23-Requires: python3-gobject
24 29 
25%description30%description
26A glib wrapper library around the libgit2 git access library.31A glib wrapper library around the libgit2 git access library.
@@ -44,6 +49,16 @@ Libraries and header files for developing applications that use libgit2-glib.
44%install49%install
45%meson_install50%meson_install
46 51 
52+%check
53+# Verify that the Ggit overrides module can be imported with the installed
54+# pygobject. This catches regressions like the pygobject >= 3.42 KeyError
55+# ("You have tried override outside of the overrides module") at build time
56+# instead of at runtime (e.g. lorax-composer crash).
57+export PYTHONPATH=%{buildroot}%{python3_sitearch}
58+export GI_TYPELIB_PATH=%{buildroot}%{_libdir}/girepository-1.0
59+export LD_LIBRARY_PATH=%{buildroot}%{_libdir}
60+%{__python3} -c "import gi; gi.require_version('Ggit', '1.0'); from gi.repository import Ggit; print('Ggit import OK:', Ggit.Branch)"
61+ 
47%files62%files
48%license COPYING63%license COPYING
49%doc AUTHORS NEWS64%doc AUTHORS NEWS
@@ -62,6 +77,15 @@ Libraries and header files for developing applications that use libgit2-glib.
62%doc %{_datadir}/gtk-doc/*77%doc %{_datadir}/gtk-doc/*
63 78 
64%changelog79%changelog
80+* Thu Aug 20 2026 Funda Wang <fundawang@yeah.net> - 1.2.1-3
81+- Add patch to fix Ggit override __module__ for pygobject 3.42+ compat
82+- Ggit.py: set __module__ on dynamically created override classes so that
83+ gi.overrides.override() passes its module check (fixes KeyError with
84+ python3-gobject >= 3.42, e.g. lorax-composer crash)
85+- Exclude gi/overrides from automatic python dependency scanning and drop
86+ the hard-coded Requires: python3-gobject (not all consumers of the C
87+ library need python-gi)
88+ 
65* Wed Aug 27 2025 wangkai <13474090681@163.com> - 1.2.1-289* Wed Aug 27 2025 wangkai <13474090681@163.com> - 1.2.1-2
66- Corrected license format90- Corrected license format
67 91