def find_program(executable, env=None, raises=False):
    """Get the full path of an executable by
    looking at PATH environment variable
    (and PATHEXT on windows)

    :return: None if program was not found,
      the full path to executable otherwise
    """
    import qibuild.config
    if executable in _FIND_PROGRAM_CACHE:
        return _FIND_PROGRAM_CACHE[executable]
    full_path = None
    res = None
    if not env:
        env = qibuild.config.get_build_env()
        if not env:
            env = os.environ
    env_path = env.get("PATH", "")
    for path in env_path.split(os.pathsep):
        res = _find_program_in_path(executable, path)
        if res:
            break
    if res:
        _FIND_PROGRAM_CACHE[executable] = res
        return res
    else:
        if raises:
            raise NotInPath(executable, env=env)
    return None
dataset/ETHPy150Open aldebaran/qibuild/python/qisys/command.py/find_program/original