ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/TWikiIB/chkpy.py
Revision: 1.1
Committed: Mon Sep 7 09:46:41 2009 UTC (15 years, 7 months ago) by geonmo
Content type: text/x-python
Branch: MAIN
Log Message:
New integration build page using TWiki

File Contents

# User Rev Content
1 geonmo 1.1 #!/usr/bin/env python
2     import urllib2, re, os, sys
3     from ROOT import gROOT, TCanvas, TPie, TH1F, TLegend
4     class makePyCheck(object) :
5     def __init__(self,tday,arch,packagename) :
6     self.tday = tday
7     self.arch = arch
8     self.packagename = packagename
9     self.summary = self.packagename[6]+'.'+self.packagename[8]+'-'+self.tday+'-'+self.packagename[23:25]
10     url = 'http://cms-service-sdtweb.web.cern.ch/cms-service-sdtweb/rc/'+self.arch+'/www/'+self.tday+'/'+self.summary+'/'+self.packagename+'/testLogs/chkPyConf.log'
11     self.contents = os.popen('wget --no-check-certificate -nv -o /dev/null -O- '+url)
12    
13     def makecanvas(self,name, xlen, ylen):
14     can = TCanvas(name,name,0,0,xlen,ylen)
15     can.SetFillColor(0)
16     can.SetFrameFillColor(0)
17     can.SetFrameLineWidth(2)
18     return can
19    
20     def mkPyCheck(self) :
21    
22     gROOT.Reset()
23    
24     contents = self.contents
25     countpac = 0
26     title = []
27     countfiles = []
28     countfile = 0
29     countline = 0
30     while 1:
31     l = contents.readline()
32     if not l:
33     countfiles.append(countfile)
34     break
35     m1 = re.search('------',l)
36     if m1:
37     countpac = countpac + 1
38     countfiles.append(countfile)
39     countfile = 0
40     countline = countline + 1
41     m2 = re.search('Package',l)
42     if m2:
43     slist = l.split()
44     title.append(slist[1])
45     countfile = countfile + 1
46     print title
47     c1 = self.makecanvas("c1",300,200)
48     c2 = self.makecanvas("c2",600,400)
49     colors = [6,4,2,8,10,12]
50     num = []
51     for i in range(0,countline):
52     num.append(countfiles[i+1]-2)
53     print num
54    
55     his1 = TH1F("pyCfgCheck","pyCfgCheck",countline,0,countline)
56     for j in range(0,countline):
57     his1.Fill(title[j],float(num[j]))
58    
59     pie = TPie(his1)
60     pie.SetRadius(0.35)
61     for j in range(0,countline):
62     pie.SetEntryFillColor(j,colors[j])
63     pie.SetTextSize(0.02)
64     pie.SetY(0.5)
65     pie.SetLabelsOffset(-.1)
66    
67     pieleg = pie.MakeLegend()
68     pieleg.SetY1(0.80)
69     pieleg.SetY2(0.95)
70     pieleg.SetX1(0.5)
71     pieleg.SetX2(0.98)
72     pieleg.SetFillColor(0)
73     c1.cd()
74     pie.Draw("3d")
75     pieleg.Draw()
76     c1.Update()
77     c1.Print("pie_thum.png")
78     c2.cd()
79     pie.Draw("3d")
80     pieleg.Draw()
81     c2.Update()
82     c2.Print("pie.png")