- Make -U and Default('source') fail gracefully.
+ - Allow the File() and Dir() methods to take a path-name string as
+ the starting directory, in addition to a Dir object.
+
From sam th:
- Dynamically check for the existence of utilities with which to
if isinstance(name, Entry):
return self.__checkClass(name, klass)
else:
+ if directory and not isinstance(directory, Dir):
+ directory = self.Dir(directory)
name, directory = self.__transformPath(name, directory)
return self.__doLookup(klass, name, directory, create)
assert os.path.normpath('./foo') in file_names, file_names
assert os.path.normpath('./bar/baz') in file_names, file_names
+class StringDirTestCase(unittest.TestCase):
+ def runTest(self):
+ """Test using a string as the second argument of
+ File() and Dir()"""
+ test = TestCmd(workdir = '')
+ test.subdir('sub')
+ fs = SCons.Node.FS.FS(test.workpath(''))
+
+ d = fs.Dir('sub', '.')
+ assert str(d) == 'sub'
+ assert d.exists()
+ f = fs.File('file', 'sub')
+ assert str(f) == os.path.join('sub', 'file')
+ assert not f.exists()
+
if __name__ == "__main__":
suite = unittest.TestSuite()
suite.addTest(BuildDirTestCase())
suite.addTest(RepositoryTestCase())
suite.addTest(find_fileTestCase())
+ suite.addTest(StringDirTestCase())
if not unittest.TextTestRunner().run(suite).wasSuccessful():
sys.exit(1)