Issue 1193: Make suffix-matching for scaners
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Wed, 18 Feb 2009 16:10:44 +0000 (16:10 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Wed, 18 Feb 2009 16:10:44 +0000 (16:10 +0000)
case-insensitive on Windows.  (Stanislav Baranov)

git-svn-id: http://scons.tigris.org/svn/scons/trunk@4003 fdb21ef1-2011-0410-befe-b5e4ea1792b1

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

index 976db1e6c1737cb93f0a30e0e22f4b4983da56d8..6eb5d5bca898a06c435f637bd9d987861bcd09e4 100644 (file)
 
 RELEASE X.X.X - XXX
 
+  From Stanislav Baranov:
+
+    - Make suffix-matching for scanners case-insensitive on Windows.
+
   From Dan Eaton:
 
     - Fix generation of Visual Studio 8 project files on x64 platforms.
index 5a1077cf83210cde651b11730bee20c39ecc60ce..f4ff191bef1b742687a8cb08da65f5b69301bd59 100644 (file)
@@ -1086,6 +1086,8 @@ class Base(SubstitutionEnvironment):
             scanners.reverse()
             for scanner in scanners:
                 for k in scanner.get_skeys(self):
+                    if self['PLATFORM'] == 'win32':
+                        k = string.lower(k)
                     result[k] = scanner
 
         self._memo['_gsm'] = result
@@ -1095,6 +1097,8 @@ class Base(SubstitutionEnvironment):
     def get_scanner(self, skey):
         """Find the appropriate scanner given a key (usually a file suffix).
         """
+        if self['PLATFORM'] == 'win32':
+            skey = string.lower(skey)
         return self._gsm().get(skey)
 
     def scanner_map_delete(self, kw=None):
index e6f1c9363aeb11a8d69226723e8c79d05a3ad79b..7d7bca0d32e74ed1692f324882570b3a2dac81e3 100644 (file)
@@ -1122,6 +1122,23 @@ env4.builder1.env, env3)
         s = map(env.get_scanner, suffixes)
         assert s == [s1, s1, None, s3, s3], s
 
+        # Verify behavior of case-insensitive suffix matches on Windows.
+        uc_suffixes = map(string.upper, suffixes)
+
+        env = Environment(SCANNERS = [s1, s2, s3],
+                          PLATFORM = 'linux')
+
+        s = map(env.get_scanner, suffixes)
+        assert s == [s1, s1, None, s2, s3], s
+
+        s = map(env.get_scanner, uc_suffixes)
+        assert s == [None, None, None, None, None], s
+
+        env['PLATFORM'] = 'win32'
+
+        s = map(env.get_scanner, uc_suffixes)
+        assert s == [s1, s1, None, s2, s3], s
+
     def test_ENV(self):
         """Test setting the external ENV in Environments
         """