Exemple #1
0
def get_executable_files(run_level_dir):
    """get executable files from a directory

    Given a directory, walk into it and return absolute path of files that are executable

    Args:
        run_level_dir ( string ) : directory path

    Return :
        scripts_list ( list ) : contains all executable files

    """
    scripts_list = []
    for root, dirs, files in os.walk(run_level_dir):
        for afile in files:
            file_abs_path = os.path.join(root, afile)
            if util.is_executable_file(file_abs_path):
                scripts_list.append(os.path.join(root, afile))
    return scripts_list
Exemple #2
0
def get_executable_files(run_level_dir):
    """get executable files from a directory

    Given a directory, walk into it and return absolute path of files that are executable

    Args:
        run_level_dir ( string ) : directory path

    Return :
        scripts_list ( list ) : contains all executable files

    """
    scripts_list = []
    for root, dirs, files in os.walk(run_level_dir):
        for afile in files:
            file_abs_path = os.path.join(root, afile)
            if util.is_executable_file(file_abs_path):
                scripts_list.append(os.path.join(root, afile))
    return scripts_list
 def test_is_executable(self):
     self.assertFalse(util.is_executable_file("wrong/path"))
     self.assertTrue(util.is_executable_file("/bin/echo"))
     self.assertFalse(util.is_executable_file("/tmp"))
Exemple #4
0
 def test_is_executable(self):
     self.assertFalse(util.is_executable_file("wrong/path"))
     self.assertTrue(util.is_executable_file("/bin/echo"))
     self.assertFalse(util.is_executable_file("/tmp"))