def _win32_find_exe(exe):
 candidates = [exe]
 if (u'.' not in exe):
  extensions = getenv(u'PATHEXT', u'').split(os.pathsep)
  candidates.extend([(exe + ext) for ext in extensions if ext.startswith(u'.')])
 for candidate in candidates:
  if exists(candidate):
   return candidate
 if (not os.path.dirname(exe)):
  for path in getenv(u'PATH').split(os.pathsep):
   if path:
    for candidate in candidates:
     full_path = os.path.join(path, candidate)
     if exists(full_path):
      return full_path
 return exe

def _win32_find_exe ( exe ) : candidates = [ exe ] if ( u'.' not in exe ) : extensions = getenv ( u'PATHEXT' , u'' ) . split ( os . pathsep ) candidates . extend ( [ ( exe + ext ) for ext in extensions if ext . startswith ( u'.' ) ] ) for candidate in candidates : if exists ( candidate ) : return candidate if ( not os . path . dirname ( exe ) ) : for path in getenv ( u'PATH' ) . split ( os . pathsep ) : if path : for candidate in candidates : full_path = os . path . join ( path , candidate ) if exists ( full_path ) : return full_path return exe
find the actual file for a windows executable .