|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r64640 - in trunk/tools/build/v2: build util
From: ghost_at_[hidden]
Date: 2010-08-06 09:26:54
Author: vladimir_prus
Date: 2010-08-06 09:26:53 EDT (Fri, 06 Aug 2010)
New Revision: 64640
URL: http://svn.boost.org/trac/boost/changeset/64640
Log:
Make the 'cached' decorator work on methods.
Text files modified:
trunk/tools/build/v2/build/property_set.py | 4 +++-
trunk/tools/build/v2/util/__init__.py | 5 ++++-
2 files changed, 7 insertions(+), 2 deletions(-)
Modified: trunk/tools/build/v2/build/property_set.py
==============================================================================
--- trunk/tools/build/v2/build/property_set.py (original)
+++ trunk/tools/build/v2/build/property_set.py 2010-08-06 09:26:53 EDT (Fri, 06 Aug 2010)
@@ -12,9 +12,11 @@
from b2.exceptions import *
from b2.util.sequence import unique
from b2.util.set import difference
+from b2.util import cached
from b2.manager import get_manager
+
def reset ():
""" Clear the module state. This is mainly for testing purposes.
"""
@@ -427,7 +429,7 @@
return self.feature_map_.get(feature, [])
- # FIXME: make this cached
+ @cached
def get_properties(self, feature):
"""Returns all contained properties associated with 'feature'"""
Modified: trunk/tools/build/v2/util/__init__.py
==============================================================================
--- trunk/tools/build/v2/util/__init__.py (original)
+++ trunk/tools/build/v2/util/__init__.py 2010-08-06 09:26:53 EDT (Fri, 06 Aug 2010)
@@ -30,7 +30,10 @@
except KeyError:
v = self.function(*args)
self.cache[args] = v
- return v
+ return v
+
+ def __get__(self, instance, type):
+ return types.MethodType(self, instance, type)
def unquote(s):
if s and s[0] == '"' and s[-1] == '"':
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk