Win32 portability fixes. (Charles Crain)
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Mon, 15 Jul 2002 17:06:59 +0000 (17:06 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Mon, 15 Jul 2002 17:06:59 +0000 (17:06 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@415 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/engine/SCons/Defaults.py
test/option--C.py

index 2a616c8b99bef2eb787fa6ddad0ff2c91e14f6e2..136b3e0c5bbd1a6b76f226a79c502e897279fd63 100644 (file)
@@ -93,14 +93,16 @@ class SharedFlagChecker:
     into a static library/program, or static objects into a
     shared library."""
 
-    def __init__(self, shared):
+    def __init__(self, shared, set_target_flag):
         self.shared = shared
+        self.set_target_flag = set_target_flag
 
     def __call__(self, source, target, env, **kw):
         if kw.has_key('shared'):
             raise SCons.Errors.UserError, "The shared= parameter to Library() or Object() no longer works.\nUse SharedObject() or SharedLibrary() instead."
-        for tgt in target:
-            tgt.attributes.shared = self.shared
+        if self.set_target_flag:
+            for tgt in target:
+                tgt.attributes.shared = self.shared
 
         for src in source:
             if hasattr(src.attributes, 'shared'):
@@ -109,21 +111,23 @@ class SharedFlagChecker:
                 elif not self.shared and src.attributes.shared:
                     raise SCons.Errors.UserError, "Source file: %s is shared and is not compatible with static target: %s" % (src, target[0])
 
-SharedCheck = SharedFlagChecker(1)
-StaticCheck = SharedFlagChecker(0)
+SharedCheck = SCons.Action.Action(SharedFlagChecker(1, 0))
+StaticCheck = SCons.Action.Action(SharedFlagChecker(0, 0))
+SharedCheckSet = SCons.Action.Action(SharedFlagChecker(1, 1))
+StaticCheckSet = SCons.Action.Action(SharedFlagChecker(0, 1))
 
-CAction = SCons.Action.Action([ StaticCheck, "$CCCOM" ])
-ShCAction = SCons.Action.Action([ SharedCheck, "$SHCCCOM" ])
-CXXAction = SCons.Action.Action([ StaticCheck, "$CXXCOM" ])
-ShCXXAction = SCons.Action.Action([ SharedCheck, "$SHCXXCOM" ])
+CAction = SCons.Action.Action([ StaticCheckSet, "$CCCOM" ])
+ShCAction = SCons.Action.Action([ SharedCheckSet, "$SHCCCOM" ])
+CXXAction = SCons.Action.Action([ StaticCheckSet, "$CXXCOM" ])
+ShCXXAction = SCons.Action.Action([ SharedCheckSet, "$SHCXXCOM" ])
 
-F77Action = SCons.Action.Action([ StaticCheck, "$F77COM" ])
-ShF77Action = SCons.Action.Action([ SharedCheck, "$SHF77COM" ])
-F77PPAction = SCons.Action.Action([ StaticCheck, "$F77PPCOM" ])
-ShF77PPAction = SCons.Action.Action([ SharedCheck, "$SHF77PPCOM" ])
+F77Action = SCons.Action.Action([ StaticCheckSet, "$F77COM" ])
+ShF77Action = SCons.Action.Action([ SharedCheckSet, "$SHF77COM" ])
+F77PPAction = SCons.Action.Action([ StaticCheckSet, "$F77PPCOM" ])
+ShF77PPAction = SCons.Action.Action([ SharedCheckSet, "$SHF77PPCOM" ])
 
-ASAction = SCons.Action.Action([ StaticCheck, "$ASCOM" ])
-ASPPAction = SCons.Action.Action([ StaticCheck, "$ASPPCOM" ])
+ASAction = SCons.Action.Action([ StaticCheckSet, "$ASCOM" ])
+ASPPAction = SCons.Action.Action([ StaticCheckSet, "$ASPPCOM" ])
 
 
 def StaticObject():
index 122dc759dc44ababb3b80fbc2c00356b9d12ce03..8fbb457f2c0069f8909b9dd0714185b5f382aac9 100644 (file)
@@ -27,8 +27,22 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 import TestSCons
 import string
 import sys
+import os.path
+import types
 
-test = TestSCons.TestSCons()
+def match_normcase(lines, matches):
+    if not type(lines) is types.ListType:
+        lines = string.split(lines, "\n")
+    if not type(matches) is types.ListType:
+        matches = string.split(matches, "\n")
+    if len(lines) != len(matches):
+        return
+    for i in range(len(lines)):
+        if os.path.normcase(lines[i]) != os.path.normcase(matches[i]):
+            return
+    return 1
+
+test = TestSCons.TestSCons(match=match_normcase)
 
 wpath = test.workpath()
 wpath_sub = test.workpath('sub')