Changeset 524 for pkpgcounter

Show
Ignore:
Timestamp:
11/28/07 16:50:03 (17 years ago)
Author:
jerome
Message:

Added helper function to later detect the presence of executable dependencies at runtime.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pkpgcounter/trunk/pkpgpdls/analyzer.py

    r523 r524  
    5656        self.workfile = None  
    5757        self.mustclose = None 
     58         
     59    def findExecutable(self, command) : 
     60        """Finds an executable in the PATH and returns True if found else False.""" 
     61        for path in os.environ.get("PATH", "").split(":") : 
     62            fullname = os.path.abspath(os.path.join(os.path.expanduser(path), command)) 
     63            if os.path.isfile(fullname) and os.access(fullname, os.X_OK) : 
     64                return True 
     65        return False 
    5866         
    5967    def getJobSize(self) :