test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions
cmsswRelease Namespace Reference

Classes

class  CMSSWReleaseTest
 

Functions

def cmsswIs44X
 
def cmsswIs52X
 
def cmsswRelease
 
def isNewerThan
 
def releaseNumber
 

Function Documentation

def cmsswRelease.cmsswIs44X ( )

Definition at line 9 of file cmsswRelease.py.

References spr.find().

9 
10 def cmsswIs44X():
11  return cmsswRelease().find('CMSSW_4_4_') != -1
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
def cmsswRelease.cmsswIs52X ( )

Definition at line 12 of file cmsswRelease.py.

References spr.find().

12 
13 def cmsswIs52X():
14  if cmsswRelease().find('CMSSW_5_2_') != -1 or \
15  cmsswRelease().find('CMSSW_5_3_') != -1:
16  return True
17  else:
18  return False
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
def cmsswRelease.cmsswRelease ( )

Definition at line 4 of file cmsswRelease.py.

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

References releaseNumber().

Referenced by cmsswRelease.CMSSWReleaseTest.test_isNewerThan().

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

Definition at line 19 of file cmsswRelease.py.

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

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