Skip to content

Commit f83de21

Browse files
committed
gnome: Look for new gobject-introspection tools names
It moved into GLib itself under a new name. Better use the new tool if available.
1 parent 3d66942 commit f83de21

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

mesonbuild/modules/gnome.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class MkEnums(_MkEnumsCommon):
198198
vtail: T.Optional[str]
199199
depends: T.List[T.Union[BuildTarget, CustomTarget, CustomTargetIndex]]
200200

201-
ToolType: TypeAlias = T.Union[Executable, ExternalProgram, OverrideProgram]
201+
ToolType: TypeAlias = T.Union[build.OverrideExecutable, ExternalProgram, OverrideProgram]
202202

203203

204204
# Differs from the CustomTarget version in that it straight defaults to True
@@ -319,6 +319,7 @@ def _find_tool(state: 'ModuleState', tool: str) -> 'ToolType':
319319
'glib-mkenums': 'glib-2.0',
320320
'g-ir-scanner': 'gobject-introspection-1.0',
321321
'g-ir-compiler': 'gobject-introspection-1.0',
322+
'gi-compile-repository': 'girepository-2.0',
322323
}
323324
depname = tool_map[tool]
324325
varname = tool.replace('-', '_')
@@ -789,12 +790,23 @@ def postconf_hook(self, b: build.Build) -> None:
789790
if self.devenv is not None:
790791
b.devenv.append(self.devenv)
791792

792-
def _get_gir_dep(self, state: 'ModuleState') -> T.Tuple[Dependency, T.Union[Executable, 'ExternalProgram', 'OverrideProgram'],
793-
T.Union[Executable, 'ExternalProgram', 'OverrideProgram']]:
793+
def _get_gir_dep(self, state: 'ModuleState') -> T.Tuple[Dependency, ToolType, ToolType]:
794794
if not self.gir_dep:
795-
self.gir_dep = state.dependency('gobject-introspection-1.0')
795+
# Look first for the compiler's new name. If it is found,
796+
# girepository-2.0 might not be available yet, in the case we are
797+
# generating GIR for girepository-2.0 itself.
798+
self.gicompiler = self._find_tool(state, 'gi-compile-repository')
799+
if self.gicompiler.found():
800+
self.gir_dep = state.dependency('girepository-2.0', required=False)
801+
if not self.gir_dep.found():
802+
self.gir_dep = InternalDependency(
803+
self.gicompiler.get_version(),
804+
[], [], [], [], [], [], [], [], {}, [], [], [],
805+
'girepository-2.0')
806+
else:
807+
self.gir_dep = state.dependency('gobject-introspection-1.0')
808+
self.gicompiler = self._find_tool(state, 'g-ir-compiler')
796809
self.giscanner = self._find_tool(state, 'g-ir-scanner')
797-
self.gicompiler = self._find_tool(state, 'g-ir-compiler')
798810
return self.gir_dep, self.giscanner, self.gicompiler
799811

800812
def _giscanner_version_compare(self, state: 'ModuleState', cmp: str) -> bool:

0 commit comments

Comments
 (0)