diff options
Diffstat (limited to 'engine/SCons/SConsign.py')
-rw-r--r-- | engine/SCons/SConsign.py | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/engine/SCons/SConsign.py b/engine/SCons/SConsign.py index bb893c1..e31a3eb 100644 --- a/engine/SCons/SConsign.py +++ b/engine/SCons/SConsign.py @@ -27,7 +27,7 @@ Writing and reading information to the .sconsign file or files. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/SConsign.py rel_2.3.5:3347:d31d5a4e74b6 2015/07/31 14:36:10 bdbaddog" +__revision__ = "src/engine/SCons/SConsign.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog" import SCons.compat @@ -122,16 +122,40 @@ class SConsignEntry(object): XXX As coded below, we do expect a '.binfo' attribute to be added, but we'll probably generalize this in the next refactorings. """ - current_version_id = 1 + __slots__ = ("binfo", "ninfo", "__weakref__") + current_version_id = 2 + def __init__(self): # Create an object attribute from the class attribute so it ends up # in the pickled data in the .sconsign file. - _version_id = self.current_version_id + #_version_id = self.current_version_id + pass + def convert_to_sconsign(self): self.binfo.convert_to_sconsign() + def convert_from_sconsign(self, dir, name): self.binfo.convert_from_sconsign(dir, name) + def __getstate__(self): + 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): + for key, value in state.items(): + if key not in ('_version_id','__weakref__'): + setattr(self, key, value) + class Base(object): """ This is the controlling class for the signatures for the collection of @@ -202,7 +226,7 @@ class DB(Base): # Read using the path relative to the top of the Repository # (self.dir.tpath) from which we're fetching the signature # information. - path = normcase(dir.tpath) + path = normcase(dir.get_tpath()) try: rawentries = db[path] except KeyError: @@ -217,7 +241,7 @@ class DB(Base): raise except Exception, e: SCons.Warnings.warn(SCons.Warnings.CorruptSConsignWarning, - "Ignoring corrupt sconsign entry : %s (%s)\n"%(self.dir.tpath, e)) + "Ignoring corrupt sconsign entry : %s (%s)\n"%(self.dir.get_tpath(), e)) for key, entry in self.entries.items(): entry.convert_from_sconsign(dir, key) @@ -244,7 +268,7 @@ class DB(Base): # directory (self.dir.path), not relative to the top of # the Repository; we only write to our own .sconsign file, # not to .sconsign files in Repositories. - path = normcase(self.dir.path) + path = normcase(self.dir.get_internal_path()) for key, entry in self.entries.items(): entry.convert_to_sconsign() db[path] = pickle.dumps(self.entries, 1) @@ -287,7 +311,7 @@ class DirFile(Dir): """ self.dir = dir - self.sconsign = os.path.join(dir.path, '.sconsign') + self.sconsign = os.path.join(dir.get_internal_path(), '.sconsign') try: fp = open(self.sconsign, 'rb') @@ -323,7 +347,7 @@ class DirFile(Dir): self.merge() - temp = os.path.join(self.dir.path, '.scons%d' % os.getpid()) + temp = os.path.join(self.dir.get_internal_path(), '.scons%d' % os.getpid()) try: file = open(temp, 'wb') fname = temp |