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) |
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 = temp.readlines() |
13 |
|
|
14 |
|
self.page.write(""" |
15 |
|
<!-- |
102 |
|
|
103 |
|
|
104 |
|
def packlist(self): |
105 |
< |
contents=self.contents |
106 |
< |
pack = [['Levels']] |
107 |
< |
j=0 |
108 |
< |
while 1: |
109 |
< |
l = contents.readline() |
110 |
< |
if not l: |
111 |
< |
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 |
< |
|
105 |
> |
contents=self.contents |
106 |
> |
pack = [['Levels']] |
107 |
> |
j=0 |
108 |
> |
writeflag = False |
109 |
> |
valueflag = False |
110 |
> |
if len(contents)==0 : |
111 |
> |
self.page.write('---+++++No data about metrics information.\n') |
112 |
|
return pack |
113 |
+ |
for line in contents : |
114 |
+ |
if line =='# Levels\n' : |
115 |
+ |
writeflag = True |
116 |
+ |
continue |
117 |
+ |
if line=='\n': |
118 |
+ |
continue |
119 |
+ |
matchLevel = re.search('[0-9]. ',line) |
120 |
+ |
if matchLevel : |
121 |
+ |
j = j + 1 |
122 |
+ |
temp = line.split() |
123 |
+ |
pack.append(temp) |
124 |
+ |
valueflag=True |
125 |
+ |
continue |
126 |
+ |
if valueflag : |
127 |
+ |
if line=='\n' : |
128 |
+ |
valueflag=False |
129 |
+ |
continue |
130 |
+ |
else : |
131 |
+ |
temp =line.strip() |
132 |
+ |
pack[j].extend(temp) |
133 |
+ |
|
134 |
+ |
return pack |
135 |
|
# repack return list [[levels], [level1, [PACKEGE1,module1,module2,...], [PACKEGE2,module1,module2], ..],[level2,[],[],...] ...] |
136 |
|
def repack(self,pack): |
137 |
|
listlen = len(pack) |