ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/TWikiIB/makeDepMetrics.py
(Generate patch)

Comparing UserCode/TWikiIB/makeDepMetrics.py (file contents):
Revision 1.1 by geonmo, Mon Sep 7 09:46:41 2009 UTC vs.
Revision 1.3 by geonmo, Mon Sep 7 22:58:39 2009 UTC

# Line 2 | Line 2
2   import re, os
3  
4   class mkDepMetrics(object) :
5 <        def __init__(self, page, tday, arch, package_name) :
5 >        def __init__(self, page, tday, arch, packagename) :
6                  self.page=page
7                  self.tday = tday
8                  self.arch = arch
9 <                self.package_name = package_name
10 <                self.url = 'https://macms01.cern.ch/ap/ignominy/'+arch+'/'+package_name+'/igRun/metrics'
11 <                self.contents = os.popen('wget --no-check-certificate -nv -o /dev/null -O- '+self.url)
12 <
13 <                self.page.write("""
14 < <!--
15 <   * Set MENU_ID = test
16 < -->
17 <
18 < <style> /* <pre> */
19 < %STARTSECTION{"css"}%
20 <
21 < #%MENU_ID% ul{
22 <  margin: 0px;
23 <  pading: 0px;
24 < }
25 <
26 < #%MENU_ID% ul li{
27 <  position:relative;    
28 <  list-style: none;
29 <  margin: 0px 0px 0px 15px;
30 <  float: left;
31 <  font-family: sans-serif;
32 <  font-weight: 800;
33 <  font-size: 12px;
34 < }
35 <
36 < #%MENU_ID% ul ul li{
37 <  position:relative;    
38 <  font-weight: 500;
39 <  float: none;
40 <  margin: 0px 0px 0px -40px;
41 <  pading: 0px;
42 <  border: none;
43 <  background-color: none;
44 <  border-top: 1px solid #F8F8F8;
45 <  border-bottom: 1px solid #C0C0C0;
46 < }
47 < #%MENU_ID%.msie ul ul li{
48 <  position:relative;    
49 <  margin-left: 0px;
50 < }
51 <
52 < #%MENU_ID% ul ul{
53 <  margin: 0px;
54 <  clear: left;
55 <  display: none;
56 <  position: absolute;
57 <  top: 20px;
58 <  left: 0px;
59 <  background-color: #E0E0E0;
60 <  border: 1px solid #808080;
61 <  width: 150px;
62 <  z-index:30;
63 < }
64 < #%MENU_ID%.msie ul ul{
65 <  width: 180px;
66 < }
67 <
68 < #%MENU_ID% ul ul ul{
69 <  top: 5px;
70 <  left: 190px;
71 < }
72 <
73 < #%MENU_ID% a:link,
74 < #%MENU_ID% a:active,
75 < #%MENU_ID% a:visited{
76 <  text-decoration: none;
77 <  color: #0E0E0E;
78 <  overflow: hidden;
79 < }
80 <
81 < #%MENU_ID% ul ul a{
82 <  padding: 0px 2px 0px 5px;
83 <  display: block;
84 <  background-color: #DCDCDC;
85 <  z-index:20;
86 < }
87 <
88 < #%MENU_ID% ul ul a:hover{
89 <  background-color: #0EEEEE;
90 < }
91 <
92 < #%MENU_ID% ul ul a.linkSubMenu:link,
93 < #%MENU_ID% ul ul a.linkSubMenu:active,
94 < #%MENU_ID% ul ul a.linkSubMenu:visited{
95 <  font-weight: 800;
96 < }
97 < %ENDSECTION{"css"}%
98 < /* </pre> */ </style>
99 < """)
100 <    
9 >                self.packagename = packagename
10 >                self.url = 'https://macms01.cern.ch/ap/ignominy/'+arch+'/'+packagename+'/igRun/metrics'
11 >                temp = os.popen('wget --no-check-certificate -nv -o /dev/null -O- '+self.url)
12 >                self.contents=[]
13 >                self.contents = temp.readlines()
14 >
15 >  
16 >        def makeSummary(self):
17 >            contents=self.contents
18 >            writeflag = False
19 >            for line in contents :
20 >                print line
21 >                print
22 >                if line=='# Summary\n' :
23 >                    writeflag = True
24 >                    continue
25 >                if line=='# Levels\n' :
26 >                    writeflag = False
27 >                    return
28 >                if line=='\n' :
29 >                    continue
30 >                if writeflag :
31 >                    self.page.write('         * '+line)
32                  
33  
34          def packlist(self):
35 <                contents=self.contents  
36 <                pack = [['Levels']]
37 <                j=0
38 <                while 1:
39 <                        l = contents.readline()
40 <                        if not l:
41 <                                    if j==0 : self.page.write('---+++++No data about metrics information.\n')
111 <                                    break
112 <                        m1 = re.search('# Levels',l)
113 <                        if m1:
114 <                                while 1:
115 <                                        l2 = contents.readline()
116 <                                        if not l2:
117 <                                            break
118 <                                        if l2=='\n':
119 <                                            continue
120 <                                        m2 = re.search('[0-9]. ',l2)
121 <                                        if m2:
122 <                                            j = j + 1
123 <                                            temp = l2.split()
124 <                                            pack.append(temp)
125 <                                        
126 <                                            while 1:
127 <                                                l3 = contents.readline()
128 <                                                if l3=='\n':
129 <                                                    break
130 <                                                if not l3:
131 <                                                    break
132 <                                                temp =l3.split()
133 <                                                pack[j].extend(temp)
134 <            
35 >            contents=self.contents  
36 >            pack = [['Levels']]
37 >            j=0
38 >            writeflag = False
39 >            valueflag = False
40 >            if len(contents)==0 :
41 >                self.page.write('---+++++No data about metrics information.\n')
42                  return pack
43 +            for line in contents :
44 +                if line =='# Levels\n' :
45 +                    writeflag = True
46 +                    print line
47 +                    continue
48 +                elif not writeflag :
49 +                    continue
50 +                if line=='\n':
51 +                    continue
52 +                matchLevel = re.search('[0-9]. ',line)
53 +                if matchLevel :
54 +                    j = j + 1
55 +                    temp = line.split()
56 +                    pack.append(temp)
57 +                    valueflag=True
58 +                    continue
59 +                if valueflag :
60 +                    if line=='\n' :
61 +                        valueflag=False
62 +                        continue
63 +                    else :
64 +                        temp =line.strip()
65 +                        print temp
66 +                        pack[j].append(temp)
67 +            return pack
68   # repack return list [[levels], [level1, [PACKEGE1,module1,module2,...], [PACKEGE2,module1,module2], ..],[level2,[],[],...] ...]
69          def repack(self,pack):
70 +            #print pack
71              listlen = len(pack)
72              pack2 = [['Levels']]
73              countpack = 0
# Line 168 | Line 101 | class mkDepMetrics(object) :
101              return pack2
102              
103          def dropdown(self,list):
104 <            self.page.write('<div id="test">\n\n')    
104 >            self.page.write('\n<div id="test">\n\n')    
105              listlen = len(list)
106              for level in range(1,listlen):
107                  self.page.write('   * !'+str(list[level][0][0])+'\n')
108                  for pack in range(1,len(list[level])):
109                      self.page.write('      * !'+str(list[level][pack][0])+'\n')
110                      for module in range(1,len(list[level][pack])):
111 <                        self.page.write('         * [[https://macms01.cern.ch/ap/ignominy/'+self.arch+'/'+self.package_name+'/igRun/subsystem.'+str(list[level][pack][0])+'/PROJECT-'+str(list[level][pack][0])+'-'+str(list[level][pack][module].replace('/','-'))+'-O.gif.html]['+str(list[level][pack][module])+']]\n')
111 >                        self.page.write('         * [[https://macms01.cern.ch/ap/ignominy/'+self.arch+'/'+self.packagename+'/igRun/subsystem.'+str(list[level][pack][0])+'/PROJECT-'+str(list[level][pack][0])+'-'+str(list[level][pack][module].replace('/','-'))+'-O.gif.html]['+str(list[level][pack][module])+']]\n')
112              self.page.write('</div>\n%INCLUDE{"Main.DropDownMenu" section="js" MENU_ID="test"}%\n<br><br>\n\n')
113  
114                    

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines