CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
checkforupdate.checkforupdate Class Reference

Public Member Functions

def __init__ (self, statusfilename='tagstatus.txt')
 
def checkforupdate (self, workingtag, isverbose=True)
 
def fetchTagsHTTP (self)
 
def runningVersion (self, cmsswWorkingBase, scriptname, isverbose=True)
 

Public Attributes

 lumiurl
 

Detailed Description

Definition at line 2 of file checkforupdate.py.

Constructor & Destructor Documentation

def checkforupdate.checkforupdate.__init__ (   self,
  statusfilename = 'tagstatus.txt' 
)

Definition at line 3 of file checkforupdate.py.

3  def __init__(self,statusfilename='tagstatus.txt'):
4  self.lumiurl='http://cms-service-lumi.web.cern.ch/cms-service-lumi/'+statusfilename
def __init__(self, statusfilename='tagstatus.txt')
def checkforupdate.checkforupdate.checkforupdate (   self,
  workingtag,
  isverbose = True 
)

Definition at line 34 of file checkforupdate.py.

References checkforupdate.checkforupdate.fetchTagsHTTP(), createfilelist.int, and split.

34  def checkforupdate(self,workingtag,isverbose=True):
35  newtags=self.fetchTagsHTTP()
36  if workingtag=='(none)':#means HEAD
37  if isverbose:
38  print 'checking update for HEAD'
39  print ' no update'
40  return []
41  w=workingtag.lstrip('V').split('-')
42  if len(w)!=3:
43  #print workingtag+' is not a release tag, can not compare'
44  return []
45  w=[int(r) for r in w]
46  updatetags=[]
47  for [tagstr,ismajor,desc] in newtags:
48  digits=[int(r) for r in tagstr.lstrip('V').split('-')]
49  if digits[0]==w[0] and digits[1]==w[1] and digits[2]==w[2]:
50  continue
51  if digits[0]<w[0]:
52  continue
53  elif digits[0]==w[0]:
54  if digits[1]<w[1]:
55  continue
56  elif digits[1]==w[1]:
57  if digits[2]<=w[2]:
58  continue
59  updatetags.append([tagstr,ismajor,desc])
60  if isverbose:
61  print 'checking update for '+workingtag
62  if not updatetags:
63  print ' no update'
64  return []
65  for [tag,ismajor,description] in updatetags:
66  if ismajor=='1':
67  print ' major update, tag ',tag+' , '+description
68  else:
69  print ' minor update, tag ',tag+' , '+description
70  return updatetags
71 
def checkforupdate(self, workingtag, isverbose=True)
double split
Definition: MVATrainer.cc:139

Member Function Documentation

def checkforupdate.checkforupdate.fetchTagsHTTP (   self)

Definition at line 5 of file checkforupdate.py.

References checkforupdate.checkforupdate.lumiurl, split, and digitizers_cfi.strip.

Referenced by checkforupdate.checkforupdate.checkforupdate().

5  def fetchTagsHTTP(self):
6  taglist=[]
7  openurl=urllib2.build_opener()
8  tagfile=openurl.open(self.lumiurl)
9  tagfileStr=tagfile.read()
10  for tag in tagfileStr.lstrip('\n').strip('\n').split('\n'):
11  fields=tag.split(',')
12  taglist.append([fields[0],fields[1],fields[2]])
13  return taglist
double split
Definition: MVATrainer.cc:139
def checkforupdate.checkforupdate.runningVersion (   self,
  cmsswWorkingBase,
  scriptname,
  isverbose = True 
)

Definition at line 14 of file checkforupdate.py.

References ALCARECOTkAlBeamHalo_cff.filter, and digitizers_cfi.strip.

14  def runningVersion(self,cmsswWorkingBase,scriptname,isverbose=True):
15  currentdir=os.getcwd()
16  os.chdir(os.path.join(cmsswWorkingBase,'src','RecoLuminosity','LumiDB','scripts'))
17  cvscmmd='cvs status '+scriptname
18  (cmmdstatus,result)=commands.getstatusoutput(cvscmmd+'| grep "Sticky Tag:"')
19  os.chdir(currentdir)
20  cleanresult=result.lstrip().strip()
21  cleanresult=re.sub(r'\s+|\t+',' ',cleanresult)
22  allfields=cleanresult.split(' ')
23  workingversion = "n/a"
24  for line in filter(lambda line: "Sticky Tag" in line, result.split('\n')):
25  workingversion = line.split()[2]
26  if workingversion=='(none)':
27  workingversion='HEAD'
28  if isverbose:
29  print 'checking current version......'
30  print ' project base : '+cmsswWorkingBase
31  print ' script : '+scriptname
32  print ' version : '+workingversion
33  return workingversion
def runningVersion(self, cmsswWorkingBase, scriptname, isverbose=True)

Member Data Documentation

checkforupdate.checkforupdate.lumiurl

Definition at line 4 of file checkforupdate.py.

Referenced by checkforupdate.checkforupdate.fetchTagsHTTP().