From: stevenknight Date: Sun, 29 May 2005 14:10:24 +0000 (+0000) Subject: Fix lookups of same-named files. X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=1421a2a4aa544fdb2a74c95fe779ffd985465f9d;p=scons.git Fix lookups of same-named files. git-svn-id: http://scons.tigris.org/svn/scons/trunk@1298 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/CHANGES.txt b/src/CHANGES.txt index f8f09fd3..f1350af4 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -397,6 +397,11 @@ RELEASE 0.97 - XXX - Add $RPATH (-R) support to the Sun linker Tool (sunlink). + From Chris Prince: + + - Look in the right directory, not always the local directory, for a + same-named file or directory conflict on disk. + From Kevin Quick: - Fix the Builder name returned from ListBuilders and other instances diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 9203e181..527d1e32 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -840,7 +840,7 @@ class FS(LocalFS): # look at the actual filesystem and make sure there isn't # a file already there - path = directory.entry_path(orig) + path = directory.entry_abspath(orig) if self.isfile(path): raise TypeError, \ "File %s found where directory expected." % path @@ -866,7 +866,7 @@ class FS(LocalFS): # make sure we don't create File nodes when there is actually # a directory at that path on the disk, and vice versa - path = directory.entry_path(last_orig) + path = directory.entry_abspath(last_orig) if fsclass == File: if self.isdir(path): raise TypeError, \ diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py index 1b31009f..6185de85 100644 --- a/src/engine/SCons/Node/FSTests.py +++ b/src/engine/SCons/Node/FSTests.py @@ -1262,6 +1262,19 @@ class FSTestCase(_tempdirTestCase): t = z.target_from_source('pre-', '-suf', lambda x: x[:-1]) assert str(t) == 'pre-z-suf', str(t) + def test_same_name(self): + """Test that a local same-named file isn't found for # Dir lookup""" + test = self.test + fs = self.fs + + test.subdir('subdir') + test.write(['subdir', 'build'], "subdir/build\n") + + subdir = fs.Dir('subdir') + fs.chdir(subdir, change_os_dir=1) + path, dir = fs._transformPath('#build/file', subdir) + self.fs._doLookup(SCons.Node.FS.File, path, dir) + def test_above_root(self): """Testing looking up a path above the root directory""" test = self.test