mirror of
https://anongit.gentoo.org/git/repo/gentoo.git
synced 2026-05-06 07:27:03 -04:00
5d34eb1bf7
new snapshot with support for lua5.5 (upstream, not Gentoo) add a patch (adopted by Debian and Fedora) for >=glib-2.87 Closes: https://bugs.gentoo.org/973586 Signed-off-by: Nicolas PARLANT <nicolas.parlant@parhuet.fr> Part-of: https://codeberg.org/gentoo/gentoo/pulls/821 Merges: https://codeberg.org/gentoo/gentoo/pulls/821 Signed-off-by: Sam James <sam@gentoo.org>
33 lines
1.4 KiB
Diff
33 lines
1.4 KiB
Diff
see PR pending https://github.com/lgi-devs/lgi/pull/352.patch
|
|
fix https://bugs.gentoo.org/973586
|
|
ffi: conform load_enum to GLib 2.87.0
|
|
--- a/lgi/ffi.lua
|
|
+++ b/lgi/ffi.lua
|
|
@@ -75,16 +75,22 @@ end
|
|
|
|
-- Creates new enum/flags table with all values from specified gtype.
|
|
function ffi.load_enum(gtype, name)
|
|
- local GObject = core.repo.GObject
|
|
+ local GLib, GObject = core.repo.GLib, core.repo.GObject
|
|
local is_flags = GObject.Type.is_a(gtype, GObject.Type.FLAGS)
|
|
local enum_component = component.create(
|
|
gtype, is_flags and enum.bitflags_mt or enum.enum_mt, name)
|
|
local type_class = GObject.TypeClass.ref(gtype)
|
|
local enum_class = core.record.cast(
|
|
type_class, is_flags and GObject.FlagsClass or GObject.EnumClass)
|
|
- for i = 0, enum_class.n_values - 1 do
|
|
- local val = core.record.fromarray(enum_class.values, i)
|
|
- enum_component[core.upcase(val.value_nick):gsub('%-', '_')] = val.value
|
|
+ if GLib.check_version(2, 87, 0) then
|
|
+ for i = 0, enum_class.n_values - 1 do
|
|
+ local val = core.record.fromarray(enum_class.values, i)
|
|
+ enum_component[core.upcase(val.value_nick):gsub('%-', '_')] = val.value
|
|
+ end
|
|
+ else
|
|
+ for _, val in ipairs(enum_class.values) do
|
|
+ enum_component[core.upcase(val.value_nick):gsub('%-', '_')] = val.value
|
|
+ end
|
|
end
|
|
type_class:unref()
|
|
return enum_component
|