self._sconsign = SCons.Sig.SConsignFile(self)
return self._sconsign
+ def __str__(self):
+ # Reimplemented from Entry since, unlike for
+ # Entry and File, we want to return the source
+ # path *even if* the builder is non-zero
+ # (which it always is for a directory)
+ if self.duplicate:
+ return self.path
+ else:
+ return self.srcpath
+
+ def exists(self):
+ # Again, directories are special...we don't care if their
+ # source path exists, we only care about the path.
+ return os.path.exists(self.path)
+
# XXX TODO?
assert f2.srcpath == os.path.normpath('src/test1'), str(f2)
assert str(f2) == os.path.normpath('build/var2/test1'), str(f2)
+ d1 = fs.Dir('build/var1')
+ d2 = fs.Dir('build/var2')
+
+ assert str(d1) == 'src', str(d1)
+ assert str(d2) == os.path.normpath('build/var2'), str(d2)
+
# Test to see if file_link() works...
test=TestCmd(workdir='')
test.subdir('src','build')
foo32 = test.workpath('build', 'var3', 'foo2' + _exe)
foo41 = test.workpath('build', 'var4', 'foo1' + _exe)
foo42 = test.workpath('build', 'var4', 'foo2' + _exe)
+foo51 = test.workpath('build', 'var5', 'foo1' + _exe)
+foo52 = test.workpath('build', 'var5', 'foo2' + _exe)
test.write('SConstruct', """
src = Dir('src')
var2 = Dir('build/var2')
var3 = Dir('build/var3')
var4 = Dir('build/var4')
+var5 = Dir('build/var5')
BuildDir('build/var1', src)
BuildDir(var2, src)
BuildDir(var3, src, duplicate=0)
BuildDir(var4, src, duplicate=0)
+BuildDir(var5, src, duplicate=0)
env = Environment(CPPPATH='#src')
SConscript('build/var1/SConscript', "env")
SConscript('build/var3/SConscript', "env")
SConscript(File('SConscript', var4), "env")
+env = Environment(CPPPATH='.')
+SConscript('build/var5/SConscript', "env")
""")
test.subdir('src')
test.run(program = foo32, stdout = "f2.c\n")
test.run(program = foo41, stdout = "f1.c\n")
test.run(program = foo42, stdout = "f2.c\n")
+test.run(program = foo51, stdout = "f1.c\n")
+test.run(program = foo52, stdout = "f2.c\n")
# Make sure we didn't duplicate the source files in build/var3.
test.fail_test(os.path.exists(test.workpath('build', 'var3', 'f1.c')))
test.fail_test(os.path.exists(test.workpath('build', 'var3', 'f2.in')))
-# Make sure we didn't duplicate the source files in build/var3.
+# Make sure we didn't duplicate the source files in build/var4.
test.fail_test(os.path.exists(test.workpath('build', 'var4', 'f1.c')))
test.fail_test(os.path.exists(test.workpath('build', 'var4', 'f2.in')))
+# Make sure we didn't duplicate the source files in build/var5.
+test.fail_test(os.path.exists(test.workpath('build', 'var5', 'f1.c')))
+test.fail_test(os.path.exists(test.workpath('build', 'var5', 'f2.in')))
+
test.pass_test()