Bug fixes: BuildDir() non-writable files, and CPPPATH/LIBPATH variable subsitution...
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 20 Dec 2001 23:23:46 +0000 (23:23 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 20 Dec 2001 23:23:46 +0000 (23:23 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@168 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/CHANGES.txt
src/engine/SCons/Node/FS.py
src/engine/SCons/Node/FSTests.py
src/engine/SCons/Util.py
src/engine/SCons/UtilTests.py

index 76bc37ef99414bf6ec6b5f8a630438aa50872957..cecf7173a9115bbda1d63d7b9b48ca266c97bbf3 100644 (file)
@@ -31,6 +31,8 @@ RELEASE 0.02 -
   - Added a GetBuildPath() method to return the full path to the
     Node for a specified string.
 
+  - Fixed variable substitution in CPPPATH and LIBPATH.
+
   From Anthony Roach:
 
   - Documented CXXFLAGS, CXXCOM, and CPPPATH.
index 5cc06acfbbfab38e27e7b910c0374185ea3c764c..ee5deaaab9eedd453fc68b9b22c09fc6ae6644bc 100644 (file)
@@ -50,7 +50,7 @@ except AttributeError:
     def file_link(src, dest):
         shutil.copyfile(src, dest)
         st=os.stat(src)
-        os.chmod(dest, stat.S_IMODE(st[stat.ST_MODE]))
+        os.chmod(dest, stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE)
 
 class PathName:
     """This is a string like object with limited capabilities (i.e.,
index f97627e89f93f5dbeae3713f5f296df56cd8979e..b166be1e939c27122973f77da16de5fef288ed31 100644 (file)
@@ -31,6 +31,7 @@ import unittest
 import SCons.Node.FS
 from TestCmd import TestCmd
 from SCons.Errors import UserError
+import stat
 
 built_it = None
 
@@ -85,6 +86,18 @@ class BuildDirTestCase(unittest.TestCase):
         assert f1.srcpath == 'src/test1', f1.srcpath
         assert f2.srcpath == 'src/test1', f2.srcpath
 
+        # Test to see if file_link() works...
+        test=TestCmd(workdir='')
+        test.subdir('src','build')
+        test.write('src/foo', 'foo\n')
+        os.chmod(test.workpath('src/foo'), stat.S_IRUSR)
+        SCons.Node.FS.file_link(test.workpath('src/foo'),
+                                test.workpath('build/foo'))
+        os.chmod(test.workpath('src/foo'), stat.S_IRUSR | stat.S_IWRITE)
+        st=os.stat(test.workpath('build/foo'))
+        assert (stat.S_IMODE(st[stat.ST_MODE]) & stat.S_IWRITE), \
+               stat.S_IMODE(st[stat.ST_MODE])
+
         exc_caught = 0
         try:
             fs = SCons.Node.FS.FS()
index 1cd51d71b40a0d3b7709cd4968d24e5707a31084..0d054987927b3fe624edafd57607daffd99e4b0f 100644 (file)
@@ -266,7 +266,7 @@ class VarInterpolator:
         src = dict[self.src]
         if not type(src) is types.ListType and not isinstance(src, UserList):
             src = [ src ]
-        return src
+        return map(lambda x, d=dict: scons_subst(x, {}, d), src)
 
     def generate(self, dict):
         if not dict.has_key(self.src):
index 615e29f81f4b062ef191ac330c65f0f222a6de44..9eebc85b0c0a59ca1992744b4ca20108ee6c2260 100644 (file)
@@ -188,17 +188,20 @@ class UtilTestCase(unittest.TestCase):
         assert dict['_LIBFLAGS'][2] == 'foobazbar', \
                dict['_LIBFLAGS'][2]
 
-        dict = {'CPPPATH'   : [ 'foo', 'bar', 'baz' ],
+        dict = {'CPPPATH'   : [ 'foo', 'bar', 'baz', '$FOO/bar' ],
                 'INCPREFIX' : 'foo',
-                'INCSUFFIX' : 'bar'}
+                'INCSUFFIX' : 'bar',
+                'FOO'       : 'baz' }
         autogenerate(dict, dir = SCons.Node.FS.default_fs.Dir('/xx'))
-        assert len(dict['_INCFLAGS']) == 3, dict('_INCFLAGS')
+        assert len(dict['_INCFLAGS']) == 4, dict['_INCFLAGS']
         assert dict['_INCFLAGS'][0] == os.path.normpath('foo/xx/foobar'), \
                dict['_INCFLAGS'][0]
         assert dict['_INCFLAGS'][1] == os.path.normpath('foo/xx/barbar'), \
                dict['_INCFLAGS'][1]
         assert dict['_INCFLAGS'][2] == os.path.normpath('foo/xx/bazbar'), \
                dict['_INCFLAGS'][2]
+        assert dict['_INCFLAGS'][3] == os.path.normpath('foo/xx/baz/barbar'), \
+               dict['_INCFLAGS'][3]
         
         
 if __name__ == "__main__":