[Scons-users] Can't get Delete Action to delete a directory.

M Busche spammymatt94 at yahoo.com
Thu Feb 7 02:50:35 EST 2013


Bill,


>  Seems like the best way to avoid this is to clean the packaging directory and recreated it?


If I was going to do stuff like that I might as well right the whole thing in shell script.  In it's current form it only copies over files that have changed; and only runs Mkdirs for those directories that are missing from the distribution dir.  Surely I can get it to only remove directories that really need to be removed...via a builder.

Thanks,

Matt



________________________________
From: William Deegan <bill at baddogconsulting.com>
To: scons-users at scons.org
Sent: Wednesday, February 6, 2013 10:36 PM
Subject: Re: [Scons-users] Can't get Delete Action to delete a directory.


On 02/06/2013 09:02 PM, M Busche wrote:

Bill,

>

>That didn't seem to help.  Same result.  Actually I'm now even

more confused because I don't understand why specifying
Dir('$TARGET') as the source doesn't produce a complaint about
circular dependencies.

>

>Why does my test program work for a file but not for a

directory?  Why are they so different?

>

Directories (for SCons) by default depend on all their contents. So
that's a non-trivial difference.




>No, I don't want Execute as I explain now.

>

>This problem is part of my effort to improve my bundler/packager

which you (and Gary) have helped me with before:  in an earlier
posting to this group (a week or two ago) you'll note that I was
asking how to run a Mkdir command without any sources. That now
works just fine.  But to do things right I also need to be able
to remove a directory.

>

>The specific scenario is as follows.

>

>1) I have an empty directory named "out" in my source code

directory structure that I want to copy to my software
distribution directory for bundling.  (Perhaps it's an output
directory for test programs or something -- whatever.)

>2) I run scons and the distribution directory gets created

including this directory named "out".

>3) Now I decide I don't like the name "out" and rename it

"output" in my source code directory tree.

>4) I run scons again and the new directory "output" gets

created, but the packager also recognizes that the directory
"out" is no longer needed and so wants to delete it.  I'm trying
to issue a command to delete this directory.  I guess I could
use Excute, but this operation is REALLY part of the software
distribution generation step and shouldn't be run until all unit
tests have completed.  I've got that dependency working for
everything else by issuing the single directory level
dependency:

>

Seems like the best way to avoid this is to clean the packaging directory and recreated it?




>Depends(Dir("dist"), Dir("test"))

>

>Because the Delete target is a directory under "dist", I would

expect this delete directory request to also be made
appropriately contingent upon the successful build of all
targets under directory "test" by the above dependency
declaration.

>




-Bill




>I hope that helps.

>

>Matt

>

>

>

>

>

>

>________________________________

> From: William Deegan <bill at baddogconsulting.com>

>To: scons-users at scons.org

>Sent: Wednesday, February 6, 2013 9:13 PM

>Subject: Re: [Scons-users] Can't get Delete Action to delete a directory.

>

>

>Matt,

>

>

>On 02/06/2013 04:13 PM, M Busche wrote:

>

>I was still hoping for some help with this.

>>

>>

>>

>>Is my Ubuntu command line capture incomprehensible?  The trace below shows how a 2-line SConstruct file will remove a simple file, but not a directory.  I don't get it.

>>

>Likely the issue is the source you specify for the

command.

>It's always up to date, thus:

>

>$ scons -Q tgt=bar

>>scons: `.' is up to date.

>>

t = Command(tgt, [], [Delete("$TARGET")])

>

>Perhaps try:

>

>t = Command(tgt,Dir('$TARGET'),[Delete("$TARGET"))

>

>Though this logic is a bit curious, what are you trying

to do?

>Perhaps you really want to use Execute()?

>

>-Bill

>

>

>

>

>>

>>Thanks for any insight you can offer into this unexpected behavior.

>>

>>

>>Matt

>>

>>

>>

>>

>>

>>

>>________________________________

>> From: M Busche <spammymatt94 at yahoo.com>

>>To: "scons-users at scons.org" <scons-users at scons.org>

>>Sent: Friday, February 1, 2013 10:30 PM

>>Subject: [Scons-users] Can't get Delete Action to delete a directory.

>>

>>

>>Here's my very simple test:

>>

>>

>>

>>$ ls -a

>>.  ..  SConstruct

>>$ cat SConstruct

>>tgt = ARGUMENTS.get('tgt', '')

>>t = Command(tgt, [],

[Delete("$TARGET")])

>>$ touch foo

>>$ ls -a

>>.  ..  foo  SConstruct

>>$ scons -Q tgt=foo

>>Delete("foo")

>>$ ls -a

>>.  ..  .sconsign.dblite  SConstruct

>>$ mkdir bar

>>$ scons -Q tgt=bar

>>scons: `.' is up to date.

>>$ ls -a

>>.  ..  bar  .sconsign.dblite  SConstruct

>>$

>>

>>

>>I must be missing something.  Can someone explain why Delete won't delete directory bar when the man page clearly states that the Delete factory works for both files and directory trees?

>>

>>

>>Thanks,

>>Matt

>>

>>

>

>_______________________________________________

>Scons-users mailing list

>Scons-users at scons.org

>http://four.pairlist.net/mailman/listinfo/scons-users

>

>

>

>

>

>_______________________________________________

Scons-users mailing list Scons-users at scons.org http://four.pairlist.net/mailman/listinfo/scons-users

_______________________________________________
Scons-users mailing list
Scons-users at scons.org
http://four.pairlist.net/mailman/listinfo/scons-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20130206/694c0b8b/attachment.htm>


More information about the Scons-users mailing list