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

William Deegan bill at baddogconsulting.com
Thu Feb 7 00:36:41 EST 2013


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> <mailto:spammymatt94 at yahoo.com>

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

>> <scons-users at scons.org> <mailto: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 <mailto: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/bd1b8ca4/attachment.htm>


More information about the Scons-users mailing list