2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-14 00:32:11 +00:00

Make the 'cached' decorator work on methods.

[SVN r64640]
This commit is contained in:
Vladimir Prus
2010-08-06 13:26:53 +00:00
parent e42df53686
commit 4e320d50c0
2 changed files with 7 additions and 2 deletions

View File

@@ -12,9 +12,11 @@ import b2.build.feature
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 @@ class PropertySet:
return self.feature_map_.get(feature, [])
# FIXME: make this cached
@cached
def get_properties(self, feature):
"""Returns all contained properties associated with 'feature'"""

View File

@@ -30,7 +30,10 @@ class cached(object):
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] == '"':