ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/report.py
(Generate patch)

Comparing COMP/CRAB/python/report.py (file contents):
Revision 1.7 by spiga, Tue May 19 12:06:03 2009 UTC vs.
Revision 1.8 by spiga, Wed May 27 14:23:26 2009 UTC

# Line 1 | Line 1
1 < #!/usr/bin/env python
2 <        
3 < ##
4 < ## MAIN PROGRAM
5 < ##
6 <
7 < import getopt,sys
8 < from DashboardAPI import report
9 <
10 < if __name__ == '__main__' :
11 <    try:
12 <        opts, args = getopt.getopt(sys.argv[1:], "f:")
13 <    except getopt.GetoptError:
14 <        # print help information and exit:
15 <        print "Unknown option"
16 <        sys.exit(1)
17 <    if len( opts)==1 :
18 <        copt=opts[0]
19 <        filename=copt[1]
20 <        try:
21 <            rfile=open(filename)
22 <        except IOError, ex:
23 <            print "Can not open input file"
24 <            sys.exit(1)
25 <        lines=rfile.readlines()
26 <        for line in lines :
27 <           args.append(line.strip())
28 < #        print args
29 < #        print "********************"
30 <    if len(args)>0 :
31 <         argstring=' '.join(args)
32 <         mytmp=argstring.split('=')
33 <         mystring=''
34 <         newkey=''
35 <         if len(mytmp)>0 :
36 <          for i in range(0, len(mytmp)-1):
37 <              mytmp[i]=mytmp[i].strip()
38 <              mytmp[i+1]=mytmp[i+1].strip()
39 <              if  newkey=='':
40 <                  ckey=mytmp[i]
41 <              else :
42 <                  ckey=newkey
43 <              if i< len(mytmp)-2 :  
44 <                  cvalue=' '.join(mytmp[i+1].split(' ')[:-1])+","
45 <              else:
46 <                  cvalue= mytmp[-1]    
47 <              newkey=mytmp[i+1].split(' ')[-1]
48 <              mystring=mystring+ckey.replace(" ",'')+"="+cvalue
49 <          args=mystring.split(',')  
50 <    report(args)
51 < #    print "***"
52 < #    print opts
53 < #    print "###"
54 < #    print args
55 <    sys.exit(0)
56 <
1 > #!/usr/bin/env python
2 >        
3 > ##
4 > ## MAIN PROGRAM
5 > ##
6 >
7 > import getopt,sys
8 > from DashboardAPI import report
9 >
10 > if __name__ == '__main__' :
11 >    try:
12 >        opts, args = getopt.getopt(sys.argv[1:], "f:")
13 >    except getopt.GetoptError:
14 >        # print help information and exit:
15 >        print "Unknown option"
16 >        sys.exit(1)
17 >    if len( opts)==1 :
18 >        copt=opts[0]
19 >        filename=copt[1]
20 >        try:
21 >            rfile=open(filename)
22 >        except IOError, ex:
23 >            print "Can not open input file"
24 >            sys.exit(1)
25 >        lines=rfile.readlines()
26 >        for line in lines :
27 >           args.append(line.strip())
28 > #        print args
29 > #        print "********************"
30 >    if len(args)>0 :
31 >         argstring=' '.join(args)
32 >         mytmp=argstring.split('=')
33 >         mystring=''
34 >         newkey=''
35 >         if len(mytmp)>0 :
36 >          for i in range(0, len(mytmp)-1):
37 >              mytmp[i]=mytmp[i].strip()
38 >              mytmp[i+1]=mytmp[i+1].strip()
39 >              if  newkey=='':
40 >                  ckey=mytmp[i]
41 >              else :
42 >                  ckey=newkey
43 >              if i< len(mytmp)-2 :  
44 >                  cvalue=' '.join(mytmp[i+1].split(' ')[:-1])+","
45 >              else:
46 >                  cvalue= mytmp[-1]    
47 >              newkey=mytmp[i+1].split(' ')[-1]
48 >              mystring=mystring+ckey.replace(" ",'')+"="+cvalue
49 >          args=mystring.split(',')  
50 >    report(args)
51 > #    print "***"
52 > #    print opts
53 > #    print "###"
54 > #    print args
55 >    sys.exit(0)
56 >

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines