summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Node/Python.py
diff options
context:
space:
mode:
authorDirk Baechle <dl9obn@darc.de>2015-08-06 17:14:50 (GMT)
committerDirk Baechle <dl9obn@darc.de>2015-08-06 17:14:50 (GMT)
commitf1dbc3edd79cfbc80e469377bf8d45624cc04d40 (patch)
tree819103cc2938aec5231da4cd07eac71ea6d90c06 /src/engine/SCons/Node/Python.py
parent1787f2cb6c75f45c6b0ac7a6c3c9c4b0ea95c5eb (diff)
parent2dd443706e2c6a2f85e9ac40a237fc2c73aab345 (diff)
downloadSCons-f1dbc3edd79cfbc80e469377bf8d45624cc04d40.zip
SCons-f1dbc3edd79cfbc80e469377bf8d45624cc04d40.tar.gz
SCons-f1dbc3edd79cfbc80e469377bf8d45624cc04d40.tar.bz2
Merged in dirkbaechle/scons : switch of core classes to slots, memoizer subsystem now uses decorators
Diffstat (limited to 'src/engine/SCons/Node/Python.py')
-rw-r--r--src/engine/SCons/Node/Python.py40
1 files changed, 38 insertions, 2 deletions
diff --git a/src/engine/SCons/Node/Python.py b/src/engine/SCons/Node/Python.py
index 3d8bdaa..f151fc5 100644
--- a/src/engine/SCons/Node/Python.py
+++ b/src/engine/SCons/Node/Python.py
@@ -32,15 +32,49 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import SCons.Node
class ValueNodeInfo(SCons.Node.NodeInfoBase):
- current_version_id = 1
+ __slots__ = ('csig',)
+ current_version_id = 2
field_list = ['csig']
def str_to_node(self, s):
return Value(s)
+ def __getstate__(self):
+ """
+ Return all fields that shall be pickled. Walk the slots in the class
+ hierarchy and add those to the state dictionary. If a '__dict__' slot is
+ available, copy all entries to the dictionary. Also include the version
+ id, which is fixed for all instances of a class.
+ """
+ state = getattr(self, '__dict__', {}).copy()
+ for obj in type(self).mro():
+ for name in getattr(obj,'__slots__',()):
+ if hasattr(self, name):
+ state[name] = getattr(self, name)
+
+ state['_version_id'] = self.current_version_id
+ try:
+ del state['__weakref__']
+ except KeyError:
+ pass
+
+ return state
+
+ def __setstate__(self, state):
+ """
+ Restore the attributes from a pickled state.
+ """
+ # TODO check or discard version
+ del state['_version_id']
+ for key, value in state.items():
+ if key not in ('__weakref__',):
+ setattr(self, key, value)
+
+
class ValueBuildInfo(SCons.Node.BuildInfoBase):
- current_version_id = 1
+ __slots__ = ()
+ current_version_id = 2
class Value(SCons.Node.Node):
"""A class for Python variables, typically passed on the command line
@@ -53,6 +87,8 @@ class Value(SCons.Node.Node):
def __init__(self, value, built_value=None):
SCons.Node.Node.__init__(self)
self.value = value
+ self.changed_since_last_build = 6
+ self.store_info = 0
if built_value is not None:
self.built_value = built_value