summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--python/Makefile6
-rw-r--r--python/qpid/messaging.py26
2 files changed, 24 insertions, 8 deletions
diff --git a/python/Makefile b/python/Makefile
index 380115db41..eec4076722 100644
--- a/python/Makefile
+++ b/python/Makefile
@@ -46,6 +46,12 @@ $(BUILD)/%.py: %.py
build: $(TARGETS)
+.PHONY: doc
+
+doc:
+ @mkdir -p $(BUILD)
+ epydoc qpid/messaging.py -o $(BUILD)/doc --no-private --no-sourcecode --include-log
+
install: build
install -d $(PYTHON_LIB)
diff --git a/python/qpid/messaging.py b/python/qpid/messaging.py
index de6063e684..6df0ef742d 100644
--- a/python/qpid/messaging.py
+++ b/python/qpid/messaging.py
@@ -30,7 +30,7 @@ Areas that still need work:
- protocol negotiation/multiprotocol impl
"""
-import connection, time, socket, sys, compat
+import connection, time, socket, sys, compat, inspect
from codec010 import StringCodec
from datatypes import timestamp, uuid4, RangedSet, Message as Message010, Serial
from exceptions import Timeout
@@ -45,13 +45,23 @@ log = getLogger("qpid.messaging")
static = staticmethod
def synchronized(meth):
- def sync_wrapper(self, *args, **kwargs):
- self.lock()
- try:
- return meth(self, *args, **kwargs)
- finally:
- self.unlock()
- return sync_wrapper
+ args, vargs, kwargs, defs = inspect.getargspec(meth)
+ scope = {}
+ scope["meth"] = meth
+ exec """
+def %s%s:
+ %s
+ %s.lock()
+ try:
+ return meth%s
+ finally:
+ %s.unlock()
+""" % (meth.__name__, inspect.formatargspec(args, vargs, kwargs, defs),
+ repr(inspect.getdoc(meth)), args[0],
+ inspect.formatargspec(args, vargs, kwargs, defs,
+ formatvalue=lambda x: ""),
+ args[0]) in scope
+ return scope[meth.__name__]
class Lockable(object):