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.12 by geonmo, Wed Sep 9 07:25:22 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 >            cycleflag = False
20 >            typeCycle = re.compile('^(Cycle \w*)')
21 >            if len(contents)==0 :
22 >                self.page.write('      * No data about summary\n')
23 >            for line in contents :
24 >                matchCycle = typeCycle.search(line)
25 >                if line=='# Summary\n' :
26 >                    self.page.write('      * Summary\n')
27 >                    writeflag = True
28 >                elif line=='# Levels\n' :
29 >                    writeflag = False
30 >                    cycleflag = False
31 >                    self.page.write('</div>\n')
32 >                    self.page.write('''<br><pre>
33 > * CCD:  Cumulative Component Dependency measures the cumulative testing cost
34 >        across the system.
35 > * ACD:  Average Component Dependency indicates the number of other packages
36 >        an average package depends on.
37 > * NCCD: Normalised Cumulative Component Dependency measures how the structure
38 >        differs from a balanced binary tree of comparable size. If NCCD is one,
39 >        the structure resembles a binary tree; if much less than one, the
40 >        packages are mostly independent; if much greater than one, the system
41 >        is fairly strongly coupled. The only universal NCCD target is to
42 >        minimise for any given software system--a high value indicates a
43 >        strongly coupled system and less coupling is better.
44 > </pre>
45 > ''')
46 >                    break
47 >                elif line=='\n' :
48 >                    continue
49 >                elif line[0:5] =='* CCD' :
50 >                    writeflag = False
51 >                elif line=='# Cycles\n' :
52 >                    self.page.write('         * Cycles\n\n')
53 >                    self.page.write('<div id="test">\n')
54 >                    cycleflag=True
55 >                elif matchCycle and cycleflag :
56 >                    self.page.write('   * '+matchCycle.group(1)+'\n')
57 >                elif cycleflag :
58 >                    self.page.write('      * !'+line.strip()+'\n')
59 >                elif writeflag :
60 >                    self.page.write('         * '+line)
61 >                else :
62 >                    continue
63                  
64  
65          def packlist(self):
66 <                contents=self.contents  
67 <                pack = [['Levels']]
68 <                j=0
69 <                while 1:
70 <                        l = contents.readline()
71 <                        if not l:
72 <                                    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 <            
66 >            contents=self.contents  
67 >            pack = [['Levels']]
68 >            j=0
69 >            writeflag = False
70 >            valueflag = False
71 >            if len(contents)==0 :
72 >                self.page.write('      * No data about metrics information.\n')
73                  return pack
74 +            for line in contents :
75 +                if line =='# Levels\n' :
76 +                    writeflag = True
77 +                    continue
78 +                elif not writeflag :
79 +                    continue
80 +                if line=='\n':
81 +                    continue
82 +                matchLevel = re.search('[0-9]. ',line)
83 +                if matchLevel :
84 +                    j = j + 1
85 +                    temp = line.split()
86 +                    pack.append(temp)
87 +                    valueflag=True
88 +                    continue
89 +                if valueflag :
90 +                    if line=='\n' :
91 +                        valueflag=False
92 +                        continue
93 +                    else :
94 +                        temp =line.strip()
95 +                        pack[j].append(temp)
96 +            return pack
97   # repack return list [[levels], [level1, [PACKEGE1,module1,module2,...], [PACKEGE2,module1,module2], ..],[level2,[],[],...] ...]
98          def repack(self,pack):
99              listlen = len(pack)
# Line 152 | Line 113 | class mkDepMetrics(object) :
113                          temp.append(title)
114                          packname.append(temp)
115                          packname[check].append(module)
155                        #print packname[0]
116                      else:
117                          if packname[check][0]==title:
158                            #print 'it\'s work!'
118                              packname[check].append(module)
119                          else:
120                              check = check + 1
# Line 168 | Line 127 | class mkDepMetrics(object) :
127              return pack2
128              
129          def dropdown(self,list):
130 <            self.page.write('<div id="test">\n\n')    
130 >            self.page.write('\n<div id="test">\n\n')    
131              listlen = len(list)
132              for level in range(1,listlen):
133                  self.page.write('   * !'+str(list[level][0][0])+'\n')
134                  for pack in range(1,len(list[level])):
135                      self.page.write('      * !'+str(list[level][pack][0])+'\n')
136                      for module in range(1,len(list[level][pack])):
137 <                        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')
137 >                        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')
138              self.page.write('</div>\n%INCLUDE{"Main.DropDownMenu" section="js" MENU_ID="test"}%\n<br><br>\n\n')
139  
140                    

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines