summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/SConsign.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-05-14 03:08:46 (GMT)
committerSteven Knight <knight@baldmt.com>2004-05-14 03:08:46 (GMT)
commit86c11822b8f41dff8ec28e4ee8a8afeec9bfaa5f (patch)
treef4e261a94be38bdc1beff13b857c54b169113baf /src/engine/SCons/SConsign.py
parente2ed7aef1547812fa9ce49ae726ae1815158936d (diff)
downloadSCons-86c11822b8f41dff8ec28e4ee8a8afeec9bfaa5f.zip
SCons-86c11822b8f41dff8ec28e4ee8a8afeec9bfaa5f.tar.gz
SCons-86c11822b8f41dff8ec28e4ee8a8afeec9bfaa5f.tar.bz2
Make the saved info opaque to the .sconsign subsystem. Lots of other cleanup.
Diffstat (limited to 'src/engine/SCons/SConsign.py')
-rw-r--r--src/engine/SCons/SConsign.py113
1 files changed, 10 insertions, 103 deletions
diff --git a/src/engine/SCons/SConsign.py b/src/engine/SCons/SConsign.py
index a91817b..c97f1b6 100644
--- a/src/engine/SCons/SConsign.py
+++ b/src/engine/SCons/SConsign.py
@@ -34,8 +34,8 @@ import os
import os.path
import time
-import SCons.Sig
import SCons.Node
+import SCons.Sig
import SCons.Warnings
#XXX Get rid of the global array so this becomes re-entrant.
@@ -48,28 +48,6 @@ def write():
for sig_file in sig_files:
sig_file.write()
-
-class Entry:
-
- """Objects of this type are pickled to the .sconsign file, so it
- should only contain simple builtin Python datatypes and no methods.
-
- This class is used to store cache information about nodes between
- scons runs for efficiency, and to store the build signature for
- nodes so that scons can determine if they are out of date. """
-
- # setup the default value for various attributes:
- # (We make the class variables so the default values won't get pickled
- # with the instances, which would waste a lot of space)
- timestamp = None
- bsig = None
- csig = None
- implicit = None
- bkids = []
- bkidsigs = []
- bact = None
- bactsig = None
-
class Base:
"""
This is the controlling class for the signatures for the collection of
@@ -88,97 +66,26 @@ class Base:
self.entries = {}
self.dirty = 0
- # A null .sconsign entry. We define this here so that it will
- # be easy to keep this in sync if/whenever we change the type of
- # information returned by the get() method, below.
- null_siginfo = (None, None, None)
-
- def get(self, filename):
- """
- Get the .sconsign entry for a file
-
- filename - the filename whose signature will be returned
- returns - (timestamp, bsig, csig)
- """
- entry = self.get_entry(filename)
- return (entry.timestamp, entry.bsig, entry.csig)
-
def get_entry(self, filename):
"""
Create an entry for the filename and return it, or if one already exists,
then return it.
"""
- try:
- return self.entries[filename]
- except (KeyError, AttributeError):
- return Entry()
+ return self.entries[filename]
- def set_entry(self, filename, entry):
+ def set_entry(self, filename, obj):
"""
Set the entry.
"""
- self.entries[filename] = entry
+ try:
+ entry = self.entries[filename]
+ except KeyError:
+ self.entries[filename] = obj
+ else:
+ for key, val in obj.__dict__.items():
+ entry.__dict__[key] = val
self.dirty = 1
- def set_csig(self, filename, csig):
- """
- Set the csig .sconsign entry for a file
-
- filename - the filename whose signature will be set
- csig - the file's content signature
- """
-
- entry = self.get_entry(filename)
- entry.csig = csig
- self.set_entry(filename, entry)
-
- def set_binfo(self, filename, bsig, bkids, bkidsigs, bact, bactsig):
- """
- Set the build info .sconsign entry for a file
-
- filename - the filename whose signature will be set
- bsig - the file's built signature
- """
-
- entry = self.get_entry(filename)
- entry.bsig = bsig
- entry.bkids = bkids
- entry.bkidsigs = bkidsigs
- entry.bact = bact
- entry.bactsig = bactsig
- self.set_entry(filename, entry)
-
- def set_timestamp(self, filename, timestamp):
- """
- Set the timestamp .sconsign entry for a file
-
- filename - the filename whose signature will be set
- timestamp - the file's timestamp
- """
-
- entry = self.get_entry(filename)
- entry.timestamp = timestamp
- self.set_entry(filename, entry)
-
- def get_implicit(self, filename):
- """Fetch the cached implicit dependencies for 'filename'"""
- entry = self.get_entry(filename)
- return entry.implicit
-
- def set_implicit(self, filename, implicit):
- """Cache the implicit dependencies for 'filename'."""
- entry = self.get_entry(filename)
- if not SCons.Util.is_List(implicit):
- implicit = [implicit]
- implicit = map(str, implicit)
- entry.implicit = implicit
- self.set_entry(filename, entry)
-
- def get_binfo(self, filename):
- """Fetch the cached implicit dependencies for 'filename'"""
- entry = self.get_entry(filename)
- return entry.bsig, entry.bkids, entry.bkidsigs, entry.bact, entry.bactsig
-
class DB(Base):
"""
A Base subclass that reads and writes signature information