[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] blktap2: Remove function decorators for Python 2.3
Hi, Function decorators were introduced in Python 2.4. This patch removes @staticmethod using staticmethod() for Python 2.3. Signed-off-by: KUWAMURA Shin'ya <kuwa@xxxxxxxxxxxxxx> -- KUWAMURA Shin'ya # HG changeset patch # User KUWAMURA Shin'ya <kuwa@xxxxxxxxxxxxxx> # Date 1277793380 -32400 # Node ID a9528a01c846d9d15ed9190474413a96e765733c # Parent 7b00193bd0334606b6f6779c3f14a1667a952fe4 blktap2: Remove function decorators for Python 2.3 Function decorators were introduced in Python 2.4. This patch removes @staticmethod using staticmethod() for Python 2.3. Signed-off-by: KUWAMURA Shin'ya <kuwa@xxxxxxxxxxxxxx> diff -r 7b00193bd033 -r a9528a01c846 tools/python/xen/xend/server/BlktapController.py --- a/tools/python/xen/xend/server/BlktapController.py Mon Jun 28 17:40:16 2010 +0100 +++ b/tools/python/xen/xend/server/BlktapController.py Tue Jun 29 15:36:20 2010 +0900 @@ -222,7 +222,6 @@ class TapdiskController(object): % (self.image, self.pid, self.minor, self.state, self.dtype, self.device) - @staticmethod def exc(*args): rc, stdout, stderr = doexec([TapdiskController.TAP_CTL] + list(args)) out, err = stdout.read().strip(), stderr.read().strip() @@ -232,8 +231,8 @@ class TapdiskController(object): raise TapdiskException('%s failed (%s %s %s)' % \ (args, rc, out, err)) return out + exc = staticmethod(exc) - @staticmethod def check(): try: TapdiskController.exc('check') @@ -241,8 +240,8 @@ class TapdiskController(object): except Exception, e: log.warn("tapdisk2 check failed: %s" % e) return -1 + check = staticmethod(check) - @staticmethod def list(): tapdisks = [] @@ -269,8 +268,8 @@ class TapdiskController(object): tapdisks.append(tapdisk) return tapdisks + list = staticmethod(list) - @staticmethod def fromDevice(device): if device.startswith(TapdiskController.TAP_DEV): minor = os.minor(os.stat(device).st_rdev) @@ -279,12 +278,12 @@ class TapdiskController(object): if len(tapdisks) == 1: return tapdisks[0] return None + fromDevice = staticmethod(fromDevice) - @staticmethod def create(dtype, image): return TapdiskController.exc('create', '-a%s:%s' % (dtype, image)) + create = staticmethod(create) - @staticmethod def destroy(device): tapdisk = TapdiskController.fromDevice(device) if tapdisk: @@ -294,19 +293,20 @@ class TapdiskController(object): '-m%s' % tapdisk.minor) else: TapdiskController.exc('free', '-m%s' % tapdisk.minor) + destroy = staticmethod(destroy) - @staticmethod def pause(device): tapdisk = TapdiskController.fromDevice(device) if tapdisk and tapdisk.pid: TapdiskController.exc('pause', '-p%s' % tapdisk.pid, '-m%s' % tapdisk.minor) + pause = staticmethod(pause) - @staticmethod def unpause(device): tapdisk = TapdiskController.fromDevice(device) if tapdisk and tapdisk.pid: TapdiskController.exc('unpause', '-p%s' % tapdisk.pid, '-m%s' % tapdisk.minor) + unpause = staticmethod(unpause) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |