CMS 3D CMS Logo

Classes | Functions
cmsswRelease Namespace Reference

Classes

class  CMSSWReleaseTest
 

Functions

def cmsswIs44X ()
 
def cmsswIs52X ()
 
def cmsswRelease ()
 
def isNewerThan (release1, release2=None)
 
def releaseNumber (release=None)
 

Function Documentation

◆ cmsswIs44X()

def cmsswRelease.cmsswIs44X ( )

Definition at line 9 of file cmsswRelease.py.

9 def cmsswIs44X():
10  return cmsswRelease().find('CMSSW_4_4_') != -1
11 

References spr.find().

◆ cmsswIs52X()

def cmsswRelease.cmsswIs52X ( )

Definition at line 12 of file cmsswRelease.py.

12 def cmsswIs52X():
13  if cmsswRelease().find('CMSSW_5_2_') != -1 or \
14  cmsswRelease().find('CMSSW_5_3_') != -1:
15  return True
16  else:
17  return False
18 

References spr.find().

◆ cmsswRelease()

def cmsswRelease.cmsswRelease ( )

Definition at line 4 of file cmsswRelease.py.

4 def cmsswRelease():
5  #return os.environ['CMSSW_BASE'].split('/')[-1]
6  #this also works when the CMSSW directory is renamed
7  return os.environ['CMSSW_VERSION']
8 

◆ isNewerThan()

def cmsswRelease.isNewerThan (   release1,
  release2 = None 
)
Checks the orders of two releases. If release2 is not set, it is taken as the current release

Definition at line 53 of file cmsswRelease.py.

53 def isNewerThan(release1, release2=None):
54  """Checks the orders of two releases. If release2 is not set, it is taken as the current release"""
55  return releaseNumber(release2) >= releaseNumber(release1)
56 
57 

References releaseNumber().

Referenced by cmsswRelease.CMSSWReleaseTest.test_isNewerThan().

◆ releaseNumber()

def cmsswRelease.releaseNumber (   release = None)

Definition at line 19 of file cmsswRelease.py.

19 def releaseNumber(release = None):
20  # first check if this is an integration build
21  if release is None:
22  release = cmsswRelease()
23  ibrel = re.compile('^CMSSW_(\d+)_(\d+)_X.*$')
24  m = ibrel.match(release)
25  if m:
26  big = int(m.group(1))
27  medium = int(m.group(2))
28  return big, medium
29  rerel = re.compile('^CMSSW_(\d+)_(\d+)_(\d+)(_\S+)*$')
30  m = rerel.match(release)
31  if m is None:
32  raise ValueError('malformed release string '+release)
33  big = int(m.group(1))
34  medium = int(m.group(2))
35  small = int(m.group(3))
36  if m.group(4): # that's either a patch or prerelease
37  prel = re.compile('_pre(\d+)')
38  patch = re.compile('_patch(\d+)')
39  pm = prel.match(m.group(4))
40  if pm: # prerelease
41  pre = int(pm.group(1))
42  return big, medium, small, pre
43  else: # patch
44  pm2 = patch.match(m.group(4))
45  if pm2:
46  pat = int(pm2.group(1))
47  return big, medium, small, pat
48  else:
49  raise ValueError('patch or prerelease string malformed '+m.group(4))
50  else:
51  return big, medium, small
52 

References createfilelist.int.

Referenced by isNewerThan(), miniAodFiles.miniAodFiles(), and cmsswRelease.CMSSWReleaseTest.test_releaseNumber().

cmsswRelease
Definition: cmsswRelease.py:1
cmsswRelease.cmsswIs44X
def cmsswIs44X()
Definition: cmsswRelease.py:9
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
cmsswRelease.cmsswIs52X
def cmsswIs52X()
Definition: cmsswRelease.py:12
cmsswRelease.cmsswRelease
def cmsswRelease()
Definition: cmsswRelease.py:4
createfilelist.int
int
Definition: createfilelist.py:10
cmsswRelease.releaseNumber
def releaseNumber(release=None)
Definition: cmsswRelease.py:19
cmsswRelease.isNewerThan
def isNewerThan(release1, release2=None)
Definition: cmsswRelease.py:53