def program_from_system(self, args: T.List[mesonlib.FileOrString], search_dirs: T.List[str], extra_info: T.List[mlog.TV_Loggable]) -> T.Optional[ExternalProgram]:
    source_dir = os.path.join(self.environment.get_source_dir(), self.subdir)
    for exename in args:
        if isinstance(exename, mesonlib.File):
            if exename.is_built:
                search_dir = os.path.join(self.environment.get_build_dir(), exename.subdir)
            else:
                search_dir = os.path.join(self.environment.get_source_dir(), exename.subdir)
            exename = exename.fname
            extra_search_dirs = []
        elif isinstance(exename, str):
            search_dir = source_dir
            extra_search_dirs = search_dirs
        else:
            raise InvalidArguments(f'find_program only accepts strings and files, not {exename!r}')
        extprog = ExternalProgram(exename, search_dir=search_dir, extra_search_dirs=extra_search_dirs, silent=True)
        if extprog.found():
            extra_info.append(f"({' '.join(extprog.get_command())})")
            return extprog
    return None
def program_from_system(self, args: T.List[mesonlib.FileOrString], search_dirs: T.List[str], extra_info: T.List[mlog.TV_Loggable]) -> T.Optional[ExternalProgram]:
    source_dir = os.path.join(self.environment.get_source_dir(), self.subdir)
    for exename in args:
        if isinstance(exename, mesonlib.File):
            if exename.is_built:
                search_dir = os.path.join(self.environment.get_build_dir(), exename.subdir)
            else:
                search_dir = os.path.join(self.environment.get_source_dir(), exename.subdir)
            exename = exename.fname
            extra_search_dirs = []
        elif isinstance(exename, str):
            search_dir = source_dir
            extra_search_dirs = search_dirs
        else:
            raise InvalidArguments(f'find_program only accepts strings and files, not {exename!r}')
        extprog = ExternalProgram(exename, search_dir=search_dir, extra_search_dirs=extra_search_dirs, silent=True)
        if extprog.found():
            extra_info.append(f"({' '.join(extprog.get_command())})")
            return extprog
    return None