summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2002-06-20 19:28:44 (GMT)
committerSteven Knight <knight@baldmt.com>2002-06-20 19:28:44 (GMT)
commit31e59488fb62ffbd3df9c469ee0b3c090fca2f30 (patch)
tree4342de9ebd920514a4776ee5dafd1a42b42b9b9c /src
parent01bba4cf479f99c67dcac6bc50603feccc89c457 (diff)
downloadSCons-31e59488fb62ffbd3df9c469ee0b3c090fca2f30.zip
SCons-31e59488fb62ffbd3df9c469ee0b3c090fca2f30.tar.gz
SCons-31e59488fb62ffbd3df9c469ee0b3c090fca2f30.tar.bz2
Change the way implicit deps are stored to make it easier to maintain backward compatibility of the .sconsign file format. (Anthony Roach)
Diffstat (limited to 'src')
-rw-r--r--src/engine/SCons/Sig/SigTests.py56
-rw-r--r--src/engine/SCons/Sig/__init__.py13
2 files changed, 51 insertions, 18 deletions
diff --git a/src/engine/SCons/Sig/SigTests.py b/src/engine/SCons/Sig/SigTests.py
index 365a0d6..548b2e4 100644
--- a/src/engine/SCons/Sig/SigTests.py
+++ b/src/engine/SCons/Sig/SigTests.py
@@ -481,46 +481,78 @@ class SConsignEntryTestCase(unittest.TestCase):
assert e.get_implicit() == None
assert e.render(m) == "- - - -"
+ # Check backward compatability with pre-0.07 format:
+ e = SCons.Sig.SConsignEntry(m, "- - - ")
+ assert e.timestamp == None
+ assert e.csig == None
+ assert e.bsig == None
+ assert e.get_implicit() == []
+ assert e.render(m) == "- - - \0\0\0\0"
+
+ # Check backward compatability with pre-0.07 format:
+ e = SCons.Sig.SConsignEntry(m, "- - -")
+ assert e.timestamp == None
+ assert e.csig == None
+ assert e.bsig == None
+ assert e.get_implicit() == None
+ assert e.render(m) == "- - - -"
+
+ e = SCons.Sig.SConsignEntry(m, "- - - \0\0\0\0")
+ assert e.timestamp == None
+ assert e.csig == None
+ assert e.bsig == None
+ assert e.get_implicit() == []
+ assert e.render(m) == "- - - \0\0\0\0"
+
+ # Check backward compatability with pre-0.08 format:
e = SCons.Sig.SConsignEntry(m, "- - - foo\0bar")
assert e.timestamp == None
assert e.csig == None
assert e.bsig == None
assert e.get_implicit() == ['foo', 'bar']
- assert e.render(m) == "- - - foo\0bar"
+ assert e.render(m) == "- - - \0\0foo\0bar\0\0"
- e = SCons.Sig.SConsignEntry(m, "123 456 789 foo bletch\0bar")
+ e = SCons.Sig.SConsignEntry(m, "- - - \0\0foo\0bar\0\0")
+ assert e.timestamp == None
+ assert e.csig == None
+ assert e.bsig == None
+ assert e.get_implicit() == ['foo', 'bar']
+ assert e.render(m) == "- - - \0\0foo\0bar\0\0"
+
+ e = SCons.Sig.SConsignEntry(m, "123 456 789 \0\0foo bletch\0bar\0\0")
assert e.timestamp == 123
assert e.bsig == 456
assert e.csig == 789
assert e.get_implicit() == ['foo bletch', 'bar']
- assert e.render(m) == "123 456 789 foo bletch\0bar"
+ assert e.render(m) == "123 456 789 \0\0foo bletch\0bar\0\0"
+ # Check backward compatability with pre-0.07 format:
e = SCons.Sig.SConsignEntry(m, "987 654 321")
assert e.timestamp == 987
assert e.bsig == 654
assert e.csig == 321
- assert e.get_implicit() == []
- assert e.render(m) == "987 654 321 " # note trailing space
+ assert e.get_implicit() == None
+ assert e.render(m) == "987 654 321 -"
- e.set_implicit(None)
+ e.set_implicit(None)
assert e.get_implicit() == None, e.get_implicit()
- e.set_implicit('')
+ e.set_implicit('')
assert e.get_implicit() == [], e.get_implicit()
- e.set_implicit('foo')
+ e.set_implicit('foo')
assert e.get_implicit() == ['foo'], e.get_implicit()
- e.set_implicit('foo bar')
+ e.set_implicit('foo bar')
assert e.get_implicit() == ['foo bar'], e.get_implicit()
- e.set_implicit(['foo'])
+ e.set_implicit(['foo'])
assert e.get_implicit() == ['foo'], e.get_implicit()
- e.set_implicit(['foo bar'])
+ e.set_implicit(['foo bar'])
assert e.get_implicit() == ['foo bar'], e.get_implicit()
- e.set_implicit(['foo', 'bar'])
+ e.set_implicit(['foo', 'bar'])
assert e.get_implicit() == ['foo', 'bar'], e.get_implicit()
class SConsignFileTestCase(unittest.TestCase):
diff --git a/src/engine/SCons/Sig/__init__.py b/src/engine/SCons/Sig/__init__.py
index c97f81e..553c9ce 100644
--- a/src/engine/SCons/Sig/__init__.py
+++ b/src/engine/SCons/Sig/__init__.py
@@ -61,9 +61,10 @@ class SConsignEntry:
if arr[2] == '-': self.csig = None
else: self.csig = module.from_string(arr[2])
- if len(arr) < 4: self.implicit = ''
- elif arr[3] == '-': self.implicit = None
- else: self.implicit = arr[3]
+ if len(arr) < 4: self.implicit = None # pre-0.07 format
+ elif arr[3] == '': self.implicit = '' # pre-0.08 format
+ elif arr[3] == '-': self.implicit = None
+ else: self.implicit = string.replace(arr[3], '\0\0', '')
except IndexError:
pass
@@ -78,7 +79,7 @@ class SConsignEntry:
else: csig = module.to_string(self.csig)
if self.implicit is None: implicit = '-'
- else: implicit = self.implicit
+ else: implicit = '\0\0%s\0\0'%self.implicit
return '%s %s %s %s' % (timestamp, bsig, csig, implicit)
@@ -94,8 +95,8 @@ class SConsignEntry:
if implicit is None:
self.implicit = None
else:
- if SCons.Util.is_String(implicit):
- implicit = [implicit]
+ if SCons.Util.is_String(implicit):
+ implicit = [implicit]
self.implicit = string.join(map(str, implicit), '\0')