Author: kpvdr
Date: 2009-11-30 13:55:47 -0500 (Mon, 30 Nov 2009)
New Revision: 3729
Modified:
store/trunk/cpp/tools/jrnl.py
store/trunk/cpp/tools/store_chk
Log:
Converted @staticmethod declarations to older fn=staticmethod(fn) declarations for RHEL4
Modified: store/trunk/cpp/tools/jrnl.py
===================================================================
--- store/trunk/cpp/tools/jrnl.py 2009-11-30 14:57:53 UTC (rev 3728)
+++ store/trunk/cpp/tools/jrnl.py 2009-11-30 18:55:47 UTC (rev 3729)
@@ -34,8 +34,12 @@
class Utils(object):
__printchars =
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!\"#$%&'()*+,-./:;<=>?@[\\]^_`{\|}~
"
+
+ # The @staticmethod declarations are not supported in RHEL4 (python 2.3.x)
+ # When RHEL4 support ends, replace these declarations and remove the old
+ # staticmethod() declaration.
- @staticmethod
+ #@staticmethod
def formatData(dsize, data):
if data == None:
return ""
@@ -46,8 +50,9 @@
if dsize != len(data):
raise Exception("Inconsistent data size: dsize=%d,
data(%d)=\"%s\"" % (dsize, len(data), datastr))
return "data(%d)=\"%s\" " % (dsize, datastr)
+ formatData = staticmethod(formatData)
- @staticmethod
+ #@staticmethod
def formatXid(xid, xidsize = None, uuidFormat = False):
if xid == None and xidsize != None:
if xidsize > 0: raise Exception("Inconsistent XID size: xidsize=%d,
xid=None" % xidsize)
@@ -61,15 +66,17 @@
elif xidsize != len(xid):
raise Exception("Inconsistent XID size: xidsize=%d,
xid(%d)=\"%s\"" % (xidsize, len(xid), xidstr))
return "xid(%d)=\"%s\" " % (xidsize, xidstr)
+ formatXid = staticmethod(formatXid)
- @staticmethod
+ #@staticmethod
def invStr(s):
si = ""
for i in range(0,len(s)):
si += chr(~ord(s[i]) & 0xff)
return si
+ invStr = staticmethod(invStr)
- @staticmethod
+ #@staticmethod
def load(f, klass):
args = Utils.__loadArgs(f, klass)
subclass = klass.discriminate(args)
@@ -78,8 +85,9 @@
result.init(f, *Utils.__loadArgs(f, subclass))
result.skip(f)
return result;
+ load = staticmethod(load)
- @staticmethod
+ #@staticmethod
def loadFileData(f, size, data):
if size == 0:
return (data, True)
@@ -98,29 +106,34 @@
else:
data = data + unpack("%ds" % (rsize), bin)[0]
return (data, not foverflow)
+ loadFileData = staticmethod(loadFileData)
- @staticmethod
+ #@staticmethod
def remBytesInBlk(f, blkSize):
foffs = f.tell()
return Utils.sizeInBytesToBlk(foffs, blkSize) - foffs;
+ remBytesInBlk = staticmethod(remBytesInBlk)
- @staticmethod
+ #@staticmethod
def sizeInBlks(size, blkSize):
return int((size + blkSize - 1) / blkSize)
+ sizeInBlks = staticmethod(sizeInBlks)
- @staticmethod
+ #@staticmethod
def sizeInBytesToBlk(size, blkSize):
return Utils.sizeInBlks(size, blkSize) * blkSize
+ sizeInBytesToBlk = staticmethod(sizeInBytesToBlk)
- @staticmethod
+ #@staticmethod
def __hexSplitStr(s, splitSize = 50):
if len(s) <= splitSize:
return Utils.__hexStr(s, 0, len(s))
# if len(s) > splitSize + 25:
# return Utils.__hexStr(s, 0, 10) + " ... " + Utils.__hexStr(s, 55,
65) + " ... " + Utils.__hexStr(s, len(s)-10, len(s))
return Utils.__hexStr(s, 0, 10) + " ... " + Utils.__hexStr(s,
len(s)-10, len(s))
+ __hexSplitStr = staticmethod(__hexSplitStr)
- @staticmethod
+ #@staticmethod
def __hexStr(s, b, e):
o = ""
for i in range(b, e):
@@ -129,24 +142,28 @@
else:
o += "\\%02x" % ord(s[i])
return o
+ __hexStr = staticmethod(__hexStr)
- @staticmethod
+ #@staticmethod
def __isPrintable(s):
return s.strip(Utils.__printchars) == ""
+ __isPrintable = staticmethod(__isPrintable)
- @staticmethod
+ #@staticmethod
def __loadArgs(f, klass):
size = calcsize(klass.format)
foffs = f.tell(),
bin = f.read(size)
if len(bin) != size: raise Exception("End of file")
return foffs + unpack(klass.format, bin)
+ __loadArgs = staticmethod(__loadArgs)
- @staticmethod
+ #@staticmethod
def __splitStr(s, splitSize = 50):
if len(s) < splitSize:
return s
return s[:25] + " ... " + s[-25:]
+ __splitStr = staticmethod(__splitStr)
#== class Warning =============================================================
@@ -197,10 +214,10 @@
return "0x%08x: [\"%s\" v=%d e=%d f=0x%04x rid=0x%x]" %
(self.foffs, self.magic, self.ver, self.endn, self.flags, self.rid)
return "0x%08x: <error, unknown magic \"%s\" (possible
overwrite boundary?)>" % (self.foffs, self.magic)
- @staticmethod
+ #@staticmethod
def discriminate(args):
return _CLASSES.get(args[1][-1], Hdr)
- #discriminate = staticmethod(discriminate)
+ discriminate = staticmethod(discriminate)
def empty(self):
return self.magic == "\x00"*4
Modified: store/trunk/cpp/tools/store_chk
===================================================================
--- store/trunk/cpp/tools/store_chk 2009-11-30 14:57:53 UTC (rev 3728)
+++ store/trunk/cpp/tools/store_chk 2009-11-30 18:55:47 UTC (rev 3729)
@@ -243,14 +243,15 @@
# Callbacks for checking against CSV test parameters. Return False if ok, True to
raise error.
- @staticmethod
+ #@staticmethod
def _csvPreRunChk(csvStoreChk):
if csvStoreChk._numMsgs == None: return
if csvStoreChk._jrnlAnal.isEmpty() and csvStoreChk._numMsgs > 0:
raise Exception("[CSV %d] All journal files are empty, but test expects
%d msg(s)." % (csvStoreChk._opts.tnum, csvStoreChk._numMsgs))
return False
+ _csvPreRunChk = staticmethod(_csvPreRunChk)
- @staticmethod
+ #@staticmethod
def _csvEnqChk(csvStoreChk, hdr):
#if csvStoreChk._numMsgs == None: return
#
@@ -266,23 +267,27 @@
if csvStoreChk._transient != None and hdr.transient != csvStoreChk._transient:
raise Exception("[CSV %d] Transience mismatch: found trans=%s; expected
%s" % (csvStoreChk._opts.tnum, hdr.transient, csvStoreChk._transient))
return False
+ _csvEnqChk = staticmethod(_csvEnqChk)
- @staticmethod
+ #@staticmethod
def _csvDeqChk(csvStoreChk, hdr):
if csvStoreChk._autoDeq != None and not csvStoreChk._autoDeq:
self._warning.append("[CSV %d] WARNING: Dequeue record rid=%d found in
non-dequeue test - ignoring." % (csvStoreChk._opts.tnum, hdr.rid))
return False
+ _csvDeqChk = staticmethod(_csvDeqChk)
- @staticmethod
+ #@staticmethod
def _csvTxnChk(csvStoreChk, hdr):
return False
+ _csvTxnChk = staticmethod(_csvTxnChk)
- @staticmethod
+ #@staticmethod
def _csvPostRunChk(csvStoreChk):
# Exclude this check if lastFileFlag is set - the count may be less than the
number of msgs sent because of journal overwriting
if csvStoreChk._numMsgs != None and not csvStoreChk._jrnlRdr._lastFileFlag and
csvStoreChk._numMsgs != csvStoreChk._jrnlRdr.msgCnt():
raise Exception("[CSV %s] Incorrect number of messages: Expected %d,
found %d" % (csvStoreChk._opts.tnum, csvStoreChk._numMsgs,
csvStoreChk._jrnlRdr.msgCnt()))
return False
+ _csvPostRunChk = staticmethod(_csvPostRunChk)
#==============================================================================
# main program