Fix case-sensitive handling when a scanner returns None as a suffix.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 19 Feb 2009 05:39:15 +0000 (05:39 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 19 Feb 2009 05:39:15 +0000 (05:39 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@4007 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/engine/SCons/Environment.py
src/engine/SCons/EnvironmentTests.py

index f4ff191bef1b742687a8cb08da65f5b69301bd59..b660c483b2a8964cd362d292266ecfc52dc13f45 100644 (file)
@@ -1086,7 +1086,7 @@ class Base(SubstitutionEnvironment):
             scanners.reverse()
             for scanner in scanners:
                 for k in scanner.get_skeys(self):
-                    if self['PLATFORM'] == 'win32':
+                    if k and self['PLATFORM'] == 'win32':
                         k = string.lower(k)
                     result[k] = scanner
 
@@ -1097,7 +1097,7 @@ class Base(SubstitutionEnvironment):
     def get_scanner(self, skey):
         """Find the appropriate scanner given a key (usually a file suffix).
         """
-        if self['PLATFORM'] == 'win32':
+        if skey and self['PLATFORM'] == 'win32':
             skey = string.lower(skey)
         return self._gsm().get(skey)
 
index 7d7bca0d32e74ed1692f324882570b3a2dac81e3..27ede15da0793cfa48804720329b43138ebf4f5a 100644 (file)
@@ -1059,6 +1059,7 @@ env4.builder1.env, env3)
         s1 = Scanner(name = 'scanner1', skeys = [".c", ".cc"])
         s2 = Scanner(name = 'scanner2', skeys = [".m4"])
         s3 = Scanner(name = 'scanner3', skeys = [".m4", ".m5"])
+        s4 = Scanner(name = 'scanner4', skeys = [None])
 
 #        XXX Tests for scanner execution through different environments,
 #        XXX if we ever want to do that some day
@@ -1139,6 +1140,12 @@ env4.builder1.env, env3)
         s = map(env.get_scanner, uc_suffixes)
         assert s == [s1, s1, None, s2, s3], s
 
+        # Verify behavior for a scanner returning None (on Windows
+        # where we might try to perform case manipulation on None).
+        env.Replace(SCANNERS = [s4])
+        s = map(env.get_scanner, suffixes)
+        assert s == [None, None, None, None, None], s
+
     def test_ENV(self):
         """Test setting the external ENV in Environments
         """