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 | d0139eba311c380b06ba433e31576899441591e0 (patch) | |
| tree | c32b094bbf515b611f4d919ff3e4cf164b48cb43 /qpid/python | |
| parent | 44a66f59059fbbb4724c6bd70f63061ddd688405 (diff) | |
| download | qpid-python-d0139eba311c380b06ba433e31576899441591e0.tar.gz | |
added make doc; modified @synchronized to preserve docstrings and argnames
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@808608 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/python')
| -rw-r--r-- | qpid/python/Makefile | 6 | ||||
| -rw-r--r-- | qpid/python/qpid/messaging.py | 26 |
2 files changed, 24 insertions, 8 deletions
diff --git a/qpid/python/Makefile b/qpid/python/Makefile index 380115db41..eec4076722 100644 --- a/qpid/python/Makefile +++ b/qpid/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/qpid/python/qpid/messaging.py b/qpid/python/qpid/messaging.py index de6063e684..6df0ef742d 100644 --- a/qpid/python/qpid/messaging.py +++ b/qpid/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): |
