diff options
Diffstat (limited to 'src/projManagement/Validation.py')
-rw-r--r-- | src/projManagement/Validation.py | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/projManagement/Validation.py b/src/projManagement/Validation.py index a3d84979..ac0473af 100644 --- a/src/projManagement/Validation.py +++ b/src/projManagement/Validation.py @@ -83,7 +83,31 @@ class Validation: else: return False - - - -
\ No newline at end of file + def validateSub(self,subDir,givenNum): + """ + This function checks if ".sub" file is present. + """ + subName = os.path.basename(str(subDir)) + lookSub = os.path.join(str(subDir),subName+".sub") + #Check existence of project + if os.path.exists(lookSub): + f = open(lookSub) + data=f.read() + f.close() + netlist=data.splitlines() + for eachline in netlist: + eachline=eachline.strip() + if len(eachline)<1: + continue + words=eachline.split() + if words[0] == '.subckt': + #The number of ports is specified in this line + #eg. '.subckt ua741 6 7 3' has 3 ports (6, 7 and 3). + numPorts = len(words) - 2 + print "Looksub",lookSub,givenNum,numPorts + if numPorts != givenNum: + return "PORT" + else: + return "True" + else: + return "DIREC"
\ No newline at end of file |