Ejemplo n.º 1
0
 def _runos(self, cmd, env={}):
     """Return result of os command perform"""
     if not env:
         env.update(os.environ.items() + [("PATH",getpathenv())] +\
                    env.items())
     retCode, programOut = runOsCommand(cmd, None, env_dict=env)
     if not retCode:
         return programOut
     return False
Ejemplo n.º 2
0
 def getProgPath(self,progname):
     """Get full path of program or False"""
     baseprogname = os.path.basename(progname)
     env = {"LANG":"C"}
     env.update(os.environ.items() + [("PATH",getpathenv())] +\
                env.items())
     res = self._runos("which %s"%progname,env=env)
     if res:
         return res[0].strip()
     elif os.path.isabs(progname) and os.path.exists(progname):
         return progname
     else:
         return False