Logo Search packages:      
Sourcecode: kayali version File versions  Download package

def pexpect::_which (   filename  )  [private]

This takes a given filename; tries to find it in the
environment path; then checks if it is executable.

Definition at line 900 of file pexpect.py.

00900                      :
    """This takes a given filename; tries to find it in the
    environment path; then checks if it is executable.
    """

    # Special case where filename already contains a path.
    if os.path.dirname(filename) != '':
        if os.access (filename, os.X_OK):
            return filename

    if not os.environ.has_key('PATH') or os.environ['PATH'] == '':
        p = os.defpath
    else:
        p = os.environ['PATH']

    # Oddly enough this was the one line that made Pexpect
    # incompatible with Python 1.5.2.
    #pathlist = p.split (os.pathsep) 
    pathlist = string.split (p, os.pathsep)

    for path in pathlist:
        f = os.path.join(path, filename)
        if os.access(f, os.X_OK):
            return f
    return None

def _split_command_line(command_line):


Generated by  Doxygen 1.6.0   Back to index