forked from forlilab/CADD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WFType.py
50 lines (39 loc) · 1.77 KB
/
WFType.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
########################################################################
########################################################################
# $Header: /mnt/raid/services/cvs/CADD/WFType.py,v 1.3 2011/02/11 22:02:29 nadya Exp $
# $Id: WFType.py,v 1.3 2011/02/11 22:02:29 nadya Exp $
import os
from CADD import __path__, WFTypes
class NodeWFType:
""" class used to describe a workflows type"""
def __init__(self, name, dir ):
self.name = None # worfklow Type name
self.dir = None # directory of individual workflows
self.wflist = {} # available workflows list. Key - short name, value - file full path
self.items = []
if name not in WFTypes.keys():
return None
self.name = name
self.dir = dir + os.sep + WFTypes[name]
if not os.path.isdir(self.dir):
self.about = "Missing %s/ directory.\nYour installation may be incomplete" % self.dir
return None
for item in os.listdir(self.dir):
if item.endswith('.py') and (item != '__about__.py'):
filenameNoExt = os.path.splitext(item)[0]
filenameNoExt = filenameNoExt.split('_')[0] # remove version and _net from the name
self.wflist[filenameNoExt] = self.dir + os.sep + item
self.items = self.wflist.items()
try:
f = file (self.dir + os.sep + '__about__.py', 'r')
exec f.read()
f.close()
self.about = about
except:
self.about = "Missing %s/__about__.py file.\nYour installation may be incomplete" % self.dir
def showWFlist(self):
if self.items :
self.items.sort()
return self.items
def showType(self):
return self.about