All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
dependencyAnalysis Namespace Reference

Functions

def QMTsniffer
 
def QMSsniffer
 
def RationalizePath
 
def sniffer
 

Function Documentation

def dependencyAnalysis.QMSsniffer (   path)

Definition at line 21 of file dependencyAnalysis.py.

21 
22 def QMSsniffer(path):
23  tree = ET.parse(RationalizePath(path))
24  root = tree.getroot()
25  finalList=[]
26  for child in root:
27  type = child.attrib['name']
28  if type == 'suite_ids' or type=='test_ids':
29  setList = child[0].findall('set')
30  textList = [l.findall('text') for l in tupleList]
31  for tl in texList:
32  finalList.append(tl[0].text)
33  return finalList
def dependencyAnalysis.QMTsniffer (   path)

Definition at line 7 of file dependencyAnalysis.py.

7 
8 def QMTsniffer(path) :
9 
10  tree = ET.parse(RationalizePath(path))
11  root = tree.getroot()
12  finalList=[]
13  for child in root:
14  type = child.attrib['name']
15  if type == 'prerequisites' :
16  tupleList = child[0].findall('tuple')
17  textList= [l.findall("text") for l in tupleList]
18  for tl in textList :
19  finalList.append(tl[0].text)
20  return finalList
def dependencyAnalysis.RationalizePath (   p)

Definition at line 34 of file dependencyAnalysis.py.

34 
35 def RationalizePath(p) :
36 
37  newPath = os.path.normpath(os.path.expandvars(p))
38  if os.path.exists(newPath) :
39  p = os.path.realpath(newPath)
40  p = os.path.realpath(newPath)
41  return p
42 
def dependencyAnalysis.sniffer (   dir,
  originDirectory = '',
  package = '' 
)

Definition at line 43 of file dependencyAnalysis.py.

43 
44 def sniffer(dir,originDirectory='',package=''):
45  dir = RationalizePath(dir)
46  os.chdir(dir)
47  finalList = dict()
48  newPackage=package
49  fileList = [ l for l in os.listdir(dir) if not l.startswith('.')]
50  if dir.endswith(".qms"):
51  t,p=os.path.split(dir)
52  newPackage+=p+"/"
53  for file in fileList:
54  if file.endswith(".qmt"):
55  finalList[newPackage+os.path.basename(file)]=QMTsniffer(file)
56  elif file.endswith(".qms") and os.path.isfile(file):
57  finalList[newPackage+os.path.basename(file)]=QMSsniffer(file)
58  elif file.endswith(".qms"):
59  file=RationalizePath(file)
60  newResult=sniffer(file,dir,package=newPackage)
61  finalList=dict(finalList.items()+newResult.items())
62  finalList[newPackage+os.path.basename(file)]=[ ld for ld in os.listdir(file) if (not l.startswith('.') and (l.endswith('.qmt') or not l.endswith('.qms')))]
63  elif os.path.isdir(file):
64  file=RationalizePath(file)
65  newResult=sniffer(file,dir,package=newPackage)
66  finalList=dict(finalList.items()+newResult.items())
67  if originDirectory!='' :
68  os.chdir(originDirectory)
69  return finalList