1
2 """Wraps an Analyzer"""
3
4 import sys
5
6 from os import path,mkdir
7
9 """
10 Wrapper for the Analyzer Classes
11 - Builds a directory for their output
12 - name is derived from the logfile-name
13 - anounces the directory to them
14 - starts the analyzer
15 """
16
18 """ @param analyze: The analyzer"""
19 self.analyzer=analyze
20
21 - def run(self,pfad=None):
22 """ runs the analyzer
23 @param pfad: path to the logfile, if no path is given it is
24 taken from the command line"""
25 if pfad==None:
26 fn=sys.argv[1]
27 else:
28 fn=pfad
29
30 pfad=path.abspath(fn)
31 dn=path.dirname(pfad)
32 oDir=path.join(dn,path.basename(pfad)+"_analyzed")
33 if not path.exists(oDir):
34 mkdir(oDir)
35
36 self.analyzer.setDirectory(oDir)
37
38 fh=open(fn,'r')
39 self.analyzer.analyze(fh)
40