def get_action_dirlist(driverpath):
""" Get the list of action directories
"""
actions_package_list = []
try:
if os.path.isfile(driverpath):
with open(driverpath, 'r') as fobj:
drv_text = fobj.read()
search_string = re.compile('package_list.*=.*\]',
re.DOTALL | re.MULTILINE)
match = re.search(search_string, drv_text)
if match:
match_string = match.group()
# extracting the text within [] and get the list of packages separated by ,
actions_package_list = re.findall(r'\[(.*)\]', match_string)[0].split(',')
print "\n actions package list: ", actions_package_list
else:
print "file {0} does not exist".format(driverpath)
except Exception, e:
print str(e)
return actions_package_list
评论列表
文章目录