diff options
| author | Florian "sp1rit" <sp1rit@disroot.org> | 2025-07-01 17:05:29 +0200 |
|---|---|---|
| committer | Jussi Pakkanen <jussi.pakkanen@mailbox.org> | 2025-08-01 13:27:49 +0300 |
| commit | e5fd63b3093ada9e9bf30c0bfa2819ad6fbb94e4 (patch) | |
| tree | c74c3f20a3bb1825552f8faabc2f44e880bb2d0c | |
| parent | ab57be75148c2faac67dba7877167772410ca5ef (diff) | |
| download | meson-e5fd63b3093ada9e9bf30c0bfa2819ad6fbb94e4.tar.gz | |
gnome: Provide fallback for legacy gi-scanner without --version
The --version argument was only added in g-ir-scanner 1.58, but the
bionic ci still uses g-ir-scanner 1.56. Don't fail if that is the case
and assume the version comparison is void.
| -rw-r--r-- | mesonbuild/modules/gnome.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 9a82e5b40..77da8f89d 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -774,9 +774,7 @@ class GnomeModule(ExtensionModule): STATIC_BUILD_REQUIRED_VERSION = ">=1.58.1" if isinstance(girtarget, (build.StaticLibrary)) and \ - not mesonlib.version_compare( - self._get_gi(state)[0].get_version(), - STATIC_BUILD_REQUIRED_VERSION): + not self._giscanner_version_compare(state, STATIC_BUILD_REQUIRED_VERSION): raise MesonException('Static libraries can only be introspected with GObject-Introspection ' + STATIC_BUILD_REQUIRED_VERSION) return girtarget @@ -797,6 +795,16 @@ class GnomeModule(ExtensionModule): self.gicompiler = self._find_tool(state, 'g-ir-compiler') return self.giscanner, self.gicompiler + def _giscanner_version_compare(self, state: 'ModuleState', cmp: str) -> bool: + # Support for --version was introduced in g-i 1.58, but Ubuntu + # Bionic shipped 1.56.1. As all our version checks are greater + # than 1.58, we can just return False if get_version fails. + try: + giscanner, _ = self._get_gi(state) + return mesonlib.version_compare(giscanner.get_version(), cmp) + except MesonException: + return False + @functools.lru_cache(maxsize=None) def _gir_has_option(self, option: str) -> bool: exe = self.giscanner @@ -991,7 +999,7 @@ class GnomeModule(ExtensionModule): giscanner, _ = self._get_gi(state) # response file supported? - rspable = mesonlib.version_compare(giscanner.get_version(), '>= 1.85.0') + rspable = self._giscanner_version_compare(state, '>= 1.85.0') return GirTarget( girfile, |
