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.2 by geonmo, Mon Sep 7 14:00:54 2009 UTC vs.
Revision 1.12 by geonmo, Wed Sep 9 07:25:22 2009 UTC

# Line 8 | Line 8 | class mkDepMetrics(object) :
8                  self.arch = arch
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)
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 <                self.page.write("""
16 < <!--
17 <   * Set MENU_ID = test
18 < -->
19 <
20 < <style> /* <pre> */
21 < %STARTSECTION{"css"}%
22 <
23 < #%MENU_ID% ul{
24 <  margin: 0px;
25 <  pading: 0px;
26 < }
27 <
28 < #%MENU_ID% ul li{
29 <  position:relative;    
30 <  list-style: none;
31 <  margin: 0px 0px 0px 15px;
32 <  float: left;
33 <  font-family: sans-serif;
34 <  font-weight: 800;
35 <  font-size: 12px;
36 < }
37 <
38 < #%MENU_ID% ul ul li{
39 <  position:relative;    
40 <  font-weight: 500;
41 <  float: none;
42 <  margin: 0px 0px 0px -40px;
43 <  pading: 0px;
44 <  border: none;
45 <  background-color: none;
46 <  border-top: 1px solid #F8F8F8;
47 <  border-bottom: 1px solid #C0C0C0;
48 < }
49 < #%MENU_ID%.msie ul ul li{
50 <  position:relative;    
51 <  margin-left: 0px;
52 < }
53 <
54 < #%MENU_ID% ul ul{
55 <  margin: 0px;
56 <  clear: left;
57 <  display: none;
58 <  position: absolute;
59 <  top: 20px;
60 <  left: 0px;
61 <  background-color: #E0E0E0;
62 <  border: 1px solid #808080;
62 <  width: 150px;
63 <  z-index:30;
64 < }
65 < #%MENU_ID%.msie ul ul{
66 <  width: 180px;
67 < }
68 <
69 < #%MENU_ID% ul ul ul{
70 <  top: 5px;
71 <  left: 190px;
72 < }
73 <
74 < #%MENU_ID% a:link,
75 < #%MENU_ID% a:active,
76 < #%MENU_ID% a:visited{
77 <  text-decoration: none;
78 <  color: #0E0E0E;
79 <  overflow: hidden;
80 < }
81 <
82 < #%MENU_ID% ul ul a{
83 <  padding: 0px 2px 0px 5px;
84 <  display: block;
85 <  background-color: #DCDCDC;
86 <  z-index:20;
87 < }
88 <
89 < #%MENU_ID% ul ul a:hover{
90 <  background-color: #0EEEEE;
91 < }
92 <
93 < #%MENU_ID% ul ul a.linkSubMenu:link,
94 < #%MENU_ID% ul ul a.linkSubMenu:active,
95 < #%MENU_ID% ul ul a.linkSubMenu:visited{
96 <  font-weight: 800;
97 < }
98 < %ENDSECTION{"css"}%
99 < /* </pre> */ </style>
100 < """)
101 <    
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):
# Line 108 | Line 69 | class mkDepMetrics(object) :
69              writeflag = False
70              valueflag = False
71              if len(contents)==0 :
72 <                self.page.write('---+++++No data about metrics information.\n')
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)
# Line 129 | Line 92 | class mkDepMetrics(object) :
92                          continue
93                      else :
94                          temp =line.strip()
95 <                        pack[j].extend(temp)
133 <            
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):
# Line 151 | Line 113 | class mkDepMetrics(object) :
113                          temp.append(title)
114                          packname.append(temp)
115                          packname[check].append(module)
154                        #print packname[0]
116                      else:
117                          if packname[check][0]==title:
157                            #print 'it\'s work!'
118                              packname[check].append(module)
119                          else:
120                              check = check + 1
# Line 167 | 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