Win32 portability.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 30 Jan 2003 15:21:58 +0000 (15:21 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 30 Jan 2003 15:21:58 +0000 (15:21 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@569 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/engine/SCons/Tool/mingw.py
src/engine/SCons/Tool/msvc.py
test/BuildDir-errors.py
test/scan-once.py

index afabea64344e7ea28cff4679f84380d09f9b7c48..2d1c5008ff29767505cd7344c0975a1e4b2fc46d 100644 (file)
@@ -137,7 +137,9 @@ def generate(env, platform):
     env['RCINCPREFIX'] = '--include-dir '
     env['RCINCSUFFIX'] = ''
     env['RCCOM'] = '$RC $RCINCFLAGS $RCFLAGS -i $SOURCE -o $TARGET'
-    env.CScan.add_skey('.rc')
+    CScan = env.get_scanner('.c')
+    if CScan:
+        CScan.add_skey('.rc')
     env['BUILDERS']['RES'] = res_builder
     
     # Some setting from the platform also have to be overridden:
index dbb7a85ca7a02685f57a740a8d160d18de7cb164..3bae021b04c369c4cfa46fcdbbaa48bc6337d96d 100644 (file)
@@ -275,7 +275,9 @@ def generate(env, platform):
     env['RC'] = 'rc'
     env['RCFLAGS'] = ''
     env['RCCOM'] = '$RC $_CPPINCFLAGS $RCFLAGS /fo$TARGET $SOURCES'
-    env.CScan.add_skey('.rc')
+    CScan = env.get_scanner('.c')
+    if CScan:
+        CScan.add_skey('.rc')
     env['BUILDERS']['RES'] = res_builder
     
     include_path, lib_path, exe_path = get_msdev_paths()
index dcfce09e4a6cd11cd0e2f45e9d0ce068f1ee08bd..f6646a7e19f164a9c9948729a14558084923ebbe 100644 (file)
@@ -76,15 +76,18 @@ test.run(chdir = 'normal', arguments = ".")
 
 test.fail_test(test.read(['normal', 'build', 'file.out']) != "normal/src/file.in\n")
 
-# Verify the error when the BuildDir itself is read-only.
-dir = os.path.join('ro-dir', 'build')
-test.subdir(dir)
-os.chmod(dir, os.stat(dir)[stat.ST_MODE] & ~stat.S_IWUSR)
-
-test.run(chdir = 'ro-dir',
-         arguments = ".",
-         status = 2,
-         stderr = "scons: *** Cannot duplicate `%s' in `build': Permission denied.\n" % os.path.join('src', 'SConscript'))
+# Verify the error when the BuildDir itself is read-only.  Don't bother
+# to test this on Win32, because the ACL (I think) still allows the
+# owner to create files in the directory even when it's read-only.
+if sys.platform != 'win32':
+    dir = os.path.join('ro-dir', 'build')
+    test.subdir(dir)
+    os.chmod(dir, os.stat(dir)[stat.ST_MODE] & ~stat.S_IWUSR)
+
+    test.run(chdir = 'ro-dir',
+             arguments = ".",
+             status = 2,
+             stderr = "scons: *** Cannot duplicate `%s' in `build': Permission denied.\n" % os.path.join('src', 'SConscript'))
 
 # Verify the error when the SConscript file within the BuildDir is
 # read-only.  Note that we have to make the directory read-only too,
index 35bb2d7df8072a9497a6492eb4daf2230ae6c836..4355998f2e68e46607ea43a3bd84715d30ed9959 100644 (file)
@@ -287,6 +287,12 @@ env = env.Copy()    # Yes, clobber intentionally
 Mylib.AddCFlags(env, "-DGOOFY_DEMO")
 Mylib.AddIncludeDirs(env, ".")
 
+# Not part of SLF's original stuff: On Win32, it's import to use the
+# original test environment when we invoke SCons recursively.
+import os
+recurse_env = env.Copy()
+recurse_env["ENV"] = os.environ
+
 # Icky code to set up process environment for "make"
 # I really ought to drop this into Mylib....
 
@@ -336,9 +342,9 @@ cmd_justlib = "%s %s -C %s" % (sys.executable, sys.argv[0], Dir("."))
 env.Command(string.split(generated_hdrs),
             ["MAKE-HEADER.py"],
             cmd_generated)
-env.Command([lib_fullname] + lib_objs,
-            lib_srcs + string.split(generated_hdrs + " " + static_hdrs),
-            cmd_justlib) 
+recurse_env.Command([lib_fullname] + lib_objs,
+                    lib_srcs + string.split(generated_hdrs + " " + static_hdrs),
+                    cmd_justlib) 
 """)
 
 test.write(['SLF', 'src', 'lib_geng', 'MAKE-HEADER.py'], """\