def program_from_system(self, args, search_dirs, silent=False):
    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('find_program only accepts strings and files, not {!r}'.format(exename))
        extprog = dependencies.ExternalProgram(exename, search_dir=search_dir, extra_search_dirs=extra_search_dirs, silent=silent)
        progobj = ExternalProgramHolder(extprog, self.subproject)
        if progobj.found():
            return progobj
def program_from_system(self, args, search_dirs, silent=False):
    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('find_program only accepts strings and files, not {!r}'.format(exename))
        extprog = dependencies.ExternalProgram(exename, search_dir=search_dir, extra_search_dirs=extra_search_dirs, silent=silent)
        progobj = ExternalProgramHolder(extprog, self.subproject)
        if progobj.found():
            return progobj