summaryrefslogtreecommitdiff
path: root/mesonbuild/modules
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r--mesonbuild/modules/gnome.py16
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,