diff options
author | Rafael H. Schloming <rhs@apache.org> | 2009-08-27 20:26:54 +0000 |
---|---|---|
committer | Rafael H. Schloming <rhs@apache.org> | 2009-08-27 20:26:54 +0000 |
commit | a435a75437cd389c6fa08ae171f7d25b1d3a7e77 (patch) | |
tree | eed55685154aa6d0f8e6e5e9791aad796410833c | |
parent | 506f66ac156140970b88592d19364d114fce5e78 (diff) | |
download | qpid-python-a435a75437cd389c6fa08ae171f7d25b1d3a7e77.tar.gz |
added make doc; modified @synchronized to preserve docstrings and argnames
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@808608 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | python/Makefile | 6 | ||||
-rw-r--r-- | python/qpid/messaging.py | 26 |
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): |