From 70d8ba68986ff5dd36388cc968f21ed3b72fbdc9 Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Wed, 18 Feb 2009 16:10:44 +0000 Subject: Issue 1193: Make suffix-matching for scaners case-insensitive on Windows. (Stanislav Baranov) --- src/CHANGES.txt | 4 ++++ src/engine/SCons/Environment.py | 4 ++++ src/engine/SCons/EnvironmentTests.py | 17 +++++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 976db1e..6eb5d5b 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -10,6 +10,10 @@ 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. diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 5a1077c..f4ff191 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -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): diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index e6f1c93..7d7bca0 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -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 """ -- cgit v0.12