diff options
-rw-r--r-- | src/CHANGES.txt | 2 | ||||
-rw-r--r-- | src/engine/SCons/Util.py | 6 | ||||
-rw-r--r-- | src/engine/SCons/UtilTests.py | 20 |
3 files changed, 18 insertions, 10 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 3f9c1b4..2ddcf5a 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -71,6 +71,8 @@ RELEASE 0.12 - XXX - Add SharedObject() support to the masm tool. + - Fix WhereIs() to return normalized paths. + RELEASE 0.11 - Tue, 11 Feb 2003 05:24:33 -0600 diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index 16ff388..3bfb79a 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -731,7 +731,7 @@ if sys.platform == 'win32': for ext in pathext: fext = f + ext if os.path.isfile(fext): - return fext + return os.path.normpath(fext) return None elif os.name == 'os2': @@ -752,7 +752,7 @@ elif os.name == 'os2': for ext in pathext: fext = f + ext if os.path.isfile(fext): - return fext + return os.path.normpath(fext) return None else: @@ -770,7 +770,7 @@ else: except: continue if stat.S_IMODE(st[stat.ST_MODE]) & 0111: - return f + return os.path.normpath(f) return None def ParseConfig(env, command, function=None): diff --git a/src/engine/SCons/UtilTests.py b/src/engine/SCons/UtilTests.py index 603631c..890f54d 100644 --- a/src/engine/SCons/UtilTests.py +++ b/src/engine/SCons/UtilTests.py @@ -508,15 +508,21 @@ class UtilTestCase(unittest.TestCase): wi = WhereIs('xxx.exe', string.join(pathdirs_1234, os.pathsep)) assert wi == test.workpath(sub3_xxx_exe), wi - if sys.platform == 'win32': - wi = WhereIs('xxx', pathext = '') - assert wi is None, wi + if sys.platform == 'win32': + wi = WhereIs('xxx', pathext = '') + assert wi is None, wi - wi = WhereIs('xxx', pathext = '.exe') - assert wi == test.workpath(sub4_xxx_exe), wi + wi = WhereIs('xxx', pathext = '.exe') + assert wi == test.workpath(sub4_xxx_exe), wi - wi = WhereIs('xxx', path = pathdirs_1234, pathext = '.BAT;.EXE') - assert string.lower(wi) == string.lower(test.workpath(sub3_xxx_exe)), wi + wi = WhereIs('xxx', path = pathdirs_1234, pathext = '.BAT;.EXE') + assert string.lower(wi) == string.lower(test.workpath(sub3_xxx_exe)), wi + + # Test that we return a normalized path even when + # the path contains forward slashes. + forward_slash = test.workpath('') + '/sub3' + wi = WhereIs('xxx', path = forward_slash, pathext = '.EXE') + assert string.lower(wi) == string.lower(test.workpath(sub3_xxx_exe)), wi def test_get_env_var(self): """Testing get_environment_var().""" |