已合并
Fix Ggit override for pygobject 3.42+ compatibility #16
Funda Wang创建于 8月20日
Fix Ggit override for pygobject 3.42+ compatibility #16
已合并
从已删除 :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.0 | 1 | %global libgit2_version 0.25.0 |
| 2 | %global glib2_version 2.44.0 | 2 | %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 | ||
| 4 | Name: libgit2-glib | 8 | Name: libgit2-glib |
| 5 | Version: 1.2.1 | 9 | Version: 1.2.1 |
| 6 | -Release: 2 | 10 | +Release: 3 |
| 7 | Summary: Git library for GLib | 11 | Summary: Git library for GLib |
| 8 | License: LGPL-2.1-or-later | 12 | License: LGPL-2.1-or-later |
| 9 | URL: https://wiki.gnome.org/Projects/Libgit2-glib | 13 | URL: https://wiki.gnome.org/Projects/Libgit2-glib |
| 10 | Source0: https://download.gnome.org/sources/libgit2-glib/1.2/libgit2-glib-%{version}.tar.xz | 14 | Source0: https://download.gnome.org/sources/libgit2-glib/1.2/libgit2-glib-%{version}.tar.xz |
| 15 | +Patch0: 0001-fix-Ggit-override-module.patch | ||
| 11 | BuildRequires: meson >= 0.61.0 | 16 | BuildRequires: meson >= 0.61.0 |
| 12 | BuildRequires: pkgconfig(gio-2.0) >= %{glib2_version} | 17 | BuildRequires: pkgconfig(gio-2.0) >= %{glib2_version} |
| 13 | BuildRequires: pkgconfig(glib-2.0) >= %{glib2_version} | 18 | BuildRequires: pkgconfig(glib-2.0) >= %{glib2_version} |
| @@ -15,12 +20,12 @@ BuildRequires: pkgconfig(gobject-2.0) >= %{glib2_version} | |||
| 15 | BuildRequires: pkgconfig(libgit2) >= 0.25.0 | 20 | BuildRequires: pkgconfig(libgit2) >= 0.25.0 |
| 16 | BuildRequires: pkgconfig(libssh2) | 21 | BuildRequires: pkgconfig(libssh2) |
| 17 | BuildRequires: pkgconfig(pygobject-3.0) >= 3.0.0 | 22 | BuildRequires: pkgconfig(pygobject-3.0) >= 3.0.0 |
| 23 | +BuildRequires: python3-gobject-base | ||
| 18 | BuildRequires: gi-docgen | 24 | BuildRequires: gi-docgen |
| 19 | BuildRequires: vala | 25 | BuildRequires: vala |
| 20 | BuildRequires: /usr/bin/g-ir-scanner | 26 | BuildRequires: /usr/bin/g-ir-scanner |
| 21 | Requires: glib2 >= %{glib2_version} | 27 | Requires: 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 | %description | 30 | %description |
| 26 | A glib wrapper library around the libgit2 git access library. | 31 | A 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 | %install | 49 | %install |
| 45 | %meson_install | 50 | %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 | %files | 62 | %files |
| 48 | %license COPYING | 63 | %license COPYING |
| 49 | %doc AUTHORS NEWS | 64 | %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 | %changelog | 79 | %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-2 | 89 | * Wed Aug 27 2025 wangkai <13474090681@163.com> - 1.2.1-2 |
| 66 | - Corrected license format | 90 | - Corrected license format |
| 67 | 91 | ||