I am trying to build a debug assembly of a particularly complex project layout. One of the things I need to do is copy the newly created DLL files on top of the existing DLL files that are under the control of Source Safe and therefore are read-only. I was hoping to use Scons to control this, but Scons errors if your target is read-only. Part of my command is to set it to readability, but my command is never executed because scons errors in the first place. Is there any way to reject this behavior?
Here is a demo. As you can see, my βturn off read-only bitβ command never starts if the read-only bit is set:
C:\scs\dev\test>type Sconstruct env = Environment() env.Command( "b.txt", "a.txt", [ r"if exist $TARGET c:\windows\system32\attrib -r $TARGET", Copy("$TARGET", "$SOURCE") ] ) C:\scs\dev\test>echo "test" > a.txt C:\scs\dev\test>scons -Q b.txt if exist b.txt c:\windows\system32\attrib -r b.txt Copy("b.txt", "a.txt") C:\scs\dev\test>echo "test2" > a.txt C:\scs\dev\test>attrib +r b.txt C:\scs\dev\test>scons -Q b.txt scons: *** [b.txt] C:\scs\dev\test\b.txt: Access is denied
Update
OK. I realized this by stepping though Skins worked. It seems that Scons deletes targets before they are created (see _rmv_existing in FS.py, as well as this page on the scons documentation page). If you encounter this problem, you can mark the target as "Jewel", but you will still have a problem if you use "-c".
There is no real good solution. Oh good.
source share