def find_program_impl(self, args, for_machine: MachineChoice=MachineChoice.HOST, required=True, silent=True, wanted='', search_dirs=None):
    if (not isinstance(args, list)):
        args = [args]
    progobj = self.program_from_overrides(args, silent=silent)
    if (progobj is None):
        progobj = self.program_from_file_for(for_machine, args, silent=silent)
    if (progobj is None):
        progobj = self.program_from_system(args, search_dirs, silent=silent)
    if ((progobj is None) and args[0].endswith('python3')):
        prog = dependencies.ExternalProgram('python3', mesonlib.python_command, silent=True)
        progobj = ExternalProgramHolder(prog, self.subproject)
    if (required and ((progobj is None) or (not progobj.found()))):
        raise InvalidArguments('Program(s) {!r} not found or not executable'.format(args))
    if (progobj is None):
        return ExternalProgramHolder(dependencies.NonExistingExternalProgram(' '.join(args)), self.subproject)
    self.store_name_lookups(args)
    if wanted:
        version = progobj.get_version(self)
        (is_found, not_found, found) = mesonlib.version_compare_many(version, wanted)
        if (not is_found):
            mlog.log('Program', mlog.bold(progobj.get_name()), 'found:', mlog.red('NO'), 'found {!r} but need:'.format(version), ', '.join(["'{}'".format(e) for e in not_found]))
            if required:
                m = 'Invalid version of program, need {!r} {!r} found {!r}.'
                raise InvalidArguments(m.format(progobj.get_name(), not_found, version))
            return ExternalProgramHolder(dependencies.NonExistingExternalProgram(' '.join(args)), self.subproject)
    return progobj
def find_program_impl(self, args, for_machine: MachineChoice=MachineChoice.HOST, required=True, silent=True, wanted=, search_dirs=None):
    if (not isinstance(args, list)):
        args = [args]
    progobj = self.program_from_overrides(args, silent=silent)
    if (progobj is None):
        progobj = self.program_from_file_for(for_machine, args, silent=silent)
    if (progobj is None):
        progobj = self.program_from_system(args, search_dirs, silent=silent)
    if ((progobj is None) and args[0].endswith('python3')):
        prog = dependencies.ExternalProgram('python3', mesonlib.python_command, silent=True)
        progobj = ExternalProgramHolder(prog, self.subproject)
    if (required and ((progobj is None) or (not progobj.found()))):
        raise InvalidArguments('Program(s) {!r} not found or not executable'.format(args))
    if (progobj is None):
        return ExternalProgramHolder(dependencies.NonExistingExternalProgram(' '.join(args)), self.subproject)
    self.store_name_lookups(args)
    if wanted:
        version = progobj.get_version(self)
        (is_found, not_found, found) = mesonlib.version_compare_many(version, wanted)
        if (not is_found):
            mlog.log('Program', mlog.bold(progobj.get_name()), 'found:', mlog.red('NO'), 'found {!r} but need:'.format(version), ', '.join(["'{}'".format(e) for e in not_found]))
            if required:
                m = 'Invalid version of program, need {!r} {!r} found {!r}.'
                raise InvalidArguments(m.format(progobj.get_name(), not_found, version))
            return ExternalProgramHolder(dependencies.NonExistingExternalProgram(' '.join(args)), self.subproject)
    return progobj