Esempio n. 1
0
 def testIsExecutable(self):
   self.assertFalse(util.IsExecutable('nonexistent_file'))
   # We use actual files on disk instead of pyfakefs because the executable is
   # set different on win that posix platforms and pyfakefs doesn't support
   # win platform well.
   self.assertFalse(util.IsExecutable(self.GetFileInTestDir('foo.txt')))
   self.assertTrue(util.IsExecutable(sys.executable))
Esempio n. 2
0
def _FindExecutableInPath(relative_executable_path, *extra_search_paths):
    search_paths = list(extra_search_paths) + os.environ['PATH'].split(
        os.pathsep)
    for search_path in search_paths:
        executable_path = os.path.join(search_path, relative_executable_path)
        if util.IsExecutable(executable_path):
            return executable_path
    return None