summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Node/Python.py
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2020-02-21 02:53:29 (GMT)
committerGitHub <noreply@github.com>2020-02-21 02:53:29 (GMT)
commit0814deb56ca870f631a415a3255ce8dd99688e01 (patch)
tree22fe52c634a5b1a483a9ad208b4e41b751a7392a /src/engine/SCons/Node/Python.py
parent420f23129a3eb298e20e2250f97eb8eefdd923d4 (diff)
parent54c36335c575a98fcf6de2ff84c16b66efa7da5e (diff)
downloadSCons-0814deb56ca870f631a415a3255ce8dd99688e01.zip
SCons-0814deb56ca870f631a415a3255ce8dd99688e01.tar.gz
SCons-0814deb56ca870f631a415a3255ce8dd99688e01.tar.bz2
Merge branch 'master' into topic/grossag/compoundactionscan
Diffstat (limited to 'src/engine/SCons/Node/Python.py')
-rw-r--r--src/engine/SCons/Node/Python.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/engine/SCons/Node/Python.py b/src/engine/SCons/Node/Python.py
index a5bcd4b..68c6ee8 100644
--- a/src/engine/SCons/Node/Python.py
+++ b/src/engine/SCons/Node/Python.py
@@ -88,7 +88,7 @@ class Value(SCons.Node.Node):
NodeInfo = ValueNodeInfo
BuildInfo = ValueBuildInfo
- def __init__(self, value, built_value=None):
+ def __init__(self, value, built_value=None, name=None):
SCons.Node.Node.__init__(self)
self.value = value
self.changed_since_last_build = 6
@@ -96,6 +96,13 @@ class Value(SCons.Node.Node):
if built_value is not None:
self.built_value = built_value
+ # Set a name so it can be a child of a node and not break
+ # its parent's implementation of Node.get_contents.
+ if name:
+ self.name = name
+ else:
+ self.name = str(value)
+
def str_for_display(self):
return repr(self.value)
@@ -177,23 +184,26 @@ class Value(SCons.Node.Node):
return contents
-def ValueWithMemo(value, built_value=None):
+def ValueWithMemo(value, built_value=None, name=None):
+ """
+ Memoized Value() node factory.
+ """
global _memo_lookup_map
# No current support for memoizing a value that needs to be built.
if built_value:
- return Value(value, built_value)
+ return Value(value, built_value, name=name)
try:
- memo_lookup_key = hash(value)
+ memo_lookup_key = hash((value, name))
except TypeError:
# Non-primitive types will hit this codepath.
- return Value(value)
+ return Value(value, name=name)
try:
return _memo_lookup_map[memo_lookup_key]
except KeyError:
- v = Value(value)
+ v = Value(value, built_value, name)
_memo_lookup_map[memo_lookup_key] = v
return v