parameters: (filename)
return_statement: return None
docstring: Given an executable filename, find in the PATH or find absolute path.
    Args:
      filename  An executable filename (string)
    Returns:
      Absolute version of filename.
      None if filename could not be found locally, absolutely, or in PATH
docstring_summary: Given an executable filename, find in the PATH or find absolute path.
    Args:
      filename  An executable filename (string)
    Returns:
      Absolute version of filename.
      None if filename could not be found locally, absolutely, or in PATH
docstring_tokens: Given an executable filename find in the PATH or find absolute path . Args : filename An executable filename ( string ) Returns : Absolute version of filename . None if filename could not be found locally absolutely or in PATH
function: def GetRealPath(filename):
    """Given an executable filename, find in the PATH or find absolute path.
    Args:
      filename  An executable filename (string)
    Returns:
      Absolute version of filename.
      None if filename could not be found locally, absolutely, or in PATH
    """
    if os.path.isabs(filename):                # already absolute
      return filename
  
    if filename.startswith('./') or  filename.startswith('../'): # relative
      return os.path.abspath(filename)
  
    path = os.getenv('PATH', '')
    for directory in path.split(':'):
      tryname = os.path.join(directory, filename)
      if os.path.exists(tryname):
        if not os.path.isabs(directory):  # relative directory
          return os.path.abspath(tryname)
        return tryname
    if os.path.exists(filename):
      return os.path.abspath(filename)
    return None
function_tokens: def GetRealPath ( filename ) : if os . path . isabs ( filename ) : # already absolute return filename if filename . startswith ( './' ) or filename . startswith ( '../' ) : # relative return os . path . abspath ( filename ) path = os . getenv ( 'PATH' , '' ) for directory in path . split ( ':' ) : tryname = os . path . join ( directory , filename ) if os . path . exists ( tryname ) : if not os . path . isabs ( directory ) : # relative directory return os . path . abspath ( tryname ) return tryname if os . path . exists ( filename ) : return os . path . abspath ( filename ) return None