@@ -286,6 +286,7 @@ def __init__(
286286 self .build_func_dict ()
287287 self .build_holder_map ()
288288 self .user_defined_options = user_defined_options
289+ self .find_overrides : T .Dict [str , Program ] = {}
289290 self .compilers : PerMachine [T .Dict [str , 'compilers.Compiler' ]] = PerMachine ({}, {})
290291 self .parse_project ()
291292 self ._redetect_machines ()
@@ -761,7 +762,7 @@ def func_run_command(self, node: mparser.BaseNode,
761762
762763 def _compiled_exe_error (self , cmd : T .Union [Program , build .Executable ]) -> T .NoReturn :
763764 descr = cmd .name if isinstance (cmd , build .Executable ) else cmd .description ()
764- for name , exe in self .build . find_overrides .items ():
765+ for name , exe in self .find_overrides .items ():
765766 if cmd == exe :
766767 raise InterpreterException (f'Program { name !r} was overridden with the compiled executable { descr !r} and therefore cannot be used during configuration' )
767768 raise InterpreterException (f'Program { descr !r} is a compiled executable and therefore cannot be used during configuration' )
@@ -995,6 +996,7 @@ def _do_subproject_meson(self, subp_name: str, subdir: str,
995996 subi .holder_map = self .holder_map
996997 subi .bound_holder_map = self .bound_holder_map
997998 subi .summary = self .summary
999+ subi .find_overrides = self .find_overrides
9981000
9991001 subi .subproject_stack = self .subproject_stack + [subp_name ]
10001002 current_active = self .active_projectname
@@ -1591,8 +1593,8 @@ def program_from_overrides(self, command_names: T.List[mesonlib.FileOrString],
15911593 for name in command_names :
15921594 if not isinstance (name , str ):
15931595 continue
1594- if name in self .build . find_overrides :
1595- exe = self .build . find_overrides [name ]
1596+ if name in self .find_overrides :
1597+ exe = self .find_overrides [name ]
15961598 extra_info .append (mlog .blue ('(overridden)' ))
15971599 return exe
15981600 return None
@@ -1605,9 +1607,9 @@ def store_name_lookups(self, command_names: T.List[mesonlib.FileOrString]) -> No
16051607 def add_find_program_override (self , name : str , exe : Program ) -> None :
16061608 if name in self .build .searched_programs :
16071609 raise InterpreterException (f'Tried to override finding of executable "{ name } " which has already been found.' )
1608- if name in self .build . find_overrides :
1610+ if name in self .find_overrides :
16091611 raise InterpreterException (f'Tried to override executable "{ name } " which has already been overridden.' )
1610- self .build . find_overrides [name ] = exe
1612+ self .find_overrides [name ] = exe
16111613 if name == 'pkg-config' and isinstance (exe , ExternalProgram ):
16121614 from ..dependencies .pkgconfig import PkgConfigInterface
16131615 PkgConfigInterface .set_program_override (exe , MachineChoice .HOST )
0 commit comments