1 from __future__
import print_function
2 import os,commands,re,urllib2
4 def __init__(self,statusfilename='tagstatus.txt'):
5 self.
lumiurl=
'http://cms-service-lumi.web.cern.ch/cms-service-lumi/'+statusfilename
8 openurl=urllib2.build_opener()
9 tagfile=openurl.open(self.
lumiurl)
10 tagfileStr=tagfile.read()
11 for tag
in tagfileStr.lstrip(
'\n').
strip(
'\n').
split(
'\n'):
13 taglist.append([fields[0],fields[1],fields[2]])
16 currentdir=os.getcwd()
17 os.chdir(os.path.join(cmsswWorkingBase,
'src',
'RecoLuminosity',
'LumiDB',
'scripts'))
18 cvscmmd=
'cvs status '+scriptname
19 (cmmdstatus,result)=commands.getstatusoutput(cvscmmd+
'| grep "Sticky Tag:"')
21 cleanresult=result.lstrip().
strip()
22 cleanresult=re.sub(
r'\s+|\t+',
' ',cleanresult)
23 allfields=cleanresult.split(
' ')
24 workingversion =
"n/a" 25 for line
in [line
for line
in result.split(
'\n')
if "Sticky Tag" in line]:
26 workingversion = line.split()[2]
27 if workingversion==
'(none)':
30 print(
'checking current version......')
31 print(
' project base : '+cmsswWorkingBase)
32 print(
' script : '+scriptname)
33 print(
' version : '+workingversion)
37 if workingtag==
'(none)':
39 print(
'checking update for HEAD')
42 w=workingtag.lstrip(
'V').
split(
'-')
48 for [tagstr,ismajor,desc]
in newtags:
49 digits=[
int(r)
for r
in tagstr.lstrip(
'V').
split(
'-')]
50 if digits[0]==w[0]
and digits[1]==w[1]
and digits[2]==w[2]:
60 updatetags.append([tagstr,ismajor,desc])
62 print(
'checking update for '+workingtag)
66 for [tag,ismajor,description]
in updatetags:
68 print(
' major update, tag ',tag+
' , '+description)
70 print(
' minor update, tag ',tag+
' , '+description)
73 if __name__==
'__main__':
74 scriptname=
'lumiCalc2.py' 75 cmsswWorkingBase=os.environ[
'CMSSW_BASE']
77 workingversion=c.runningVersion(cmsswWorkingBase,scriptname)
79 c.checkforupdate(workingversion)
def checkforupdate(self, workingtag, isverbose=True)
S & print(S &os, JobReport::InputFile const &f)
def runningVersion(self, cmsswWorkingBase, scriptname, isverbose=True)
def __init__(self, statusfilename='tagstatus.txt')