7 return os.environ[
'CMSSW_VERSION']
23 ibrel = re.compile(
'^CMSSW_(\d+)_(\d+)_X.*$')
24 m = ibrel.match(release)
27 medium =
int(m.group(2))
29 rerel = re.compile(
'^CMSSW_(\d+)_(\d+)_(\d+)(_\S+)*$')
30 m = rerel.match(release)
32 raise ValueError(
'malformed release string '+release)
34 medium =
int(m.group(2))
35 small =
int(m.group(3))
37 prel = re.compile(
'_pre(\d+)')
38 patch = re.compile(
'_patch(\d+)')
39 pm = prel.match(m.group(4))
41 pre =
int(pm.group(1))
42 return big, medium, small, pre
44 pm2 = patch.match(m.group(4))
46 pat =
int(pm2.group(1))
47 return big, medium, small, pat
49 raise ValueError(
'patch or prerelease string malformed '+m.group(4))
51 return big, medium, small
54 """Checks the orders of two releases. If release2 is not set, it is taken as the current release""" 58 if __name__ ==
'__main__':
65 self.assertTrue(rel.startswith(
'CMSSW_'))
68 self.assertEqual(out, (7,2,1))
70 self.assertEqual(out, (10,2,1,4))
72 self.assertEqual(out, (7,3))
74 self.assertEqual(out, (7,3,0,2))
75 self.assertRaises(ValueError, releaseNumber,
'foobar')
76 self.assertRaises(ValueError, releaseNumber,
'CMSSW_1_2_3_xat3')
77 self.assertRaises(ValueError, releaseNumber,
'CMSSW_1_2_a')
79 self.assertTrue(
isNewerThan(
'CMSSW_5_3_1',
'CMSSW_7_1_0') )
80 self.assertTrue(
isNewerThan(
'CMSSW_5_3_1',
'CMSSW_5_3_1_patch1') )
81 self.assertTrue(
isNewerThan(
'CMSSW_5_3_1',
'CMSSW_5_3_1_pre1') )
82 self.assertTrue(
isNewerThan(
'CMSSW_5_3_1_pre1',
'CMSSW_5_3_1_pre2') )
def test_releaseNumber(self)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
def test_isNewerThan(self)
def isNewerThan(release1, release2=None)
def test_cmsswRelease(self)
def releaseNumber(release=None)