From d39d74e9c772611c1dcd2fbcdc95bf87141579f5 Mon Sep 17 00:00:00 2001 From: stevenknight Date: Thu, 19 Feb 2009 05:39:15 +0000 Subject: [PATCH] Fix case-sensitive handling when a scanner returns None as a suffix. git-svn-id: http://scons.tigris.org/svn/scons/trunk@4007 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/engine/SCons/Environment.py | 4 ++-- src/engine/SCons/EnvironmentTests.py | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index f4ff191b..b660c483 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -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) diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 7d7bca0d..27ede15d 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -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 """ -- 2.26.2