[Scons-users] How to create a build rule for a target with no sources

M Busche spammymatt94 at yahoo.com
Tue Jan 29 23:01:17 EST 2013


Gary,

Works good.  So now I can write:

        Command("dist/test/output", [], Mkdir("$TARGET"))

That looks much better, but I still feel like there should be a builder for this:


        CreateDir("dist/test/output")

I guess I could write one.


Thanks much,
Matt



________________________________
From: M Busche <spammymatt94 at yahoo.com>
To: Bill Deegan <bill at baddogconsulting.com>; SCons users mailing list <scons-users at scons.org>
Sent: Tuesday, January 29, 2013 5:25 PM
Subject: Re: [Scons-users] How to create a build rule for a target with no sources


Bill,

As I said, I don't want to give a source.  So if we limit ourselves to the scope of my question, then Yes, I always want it to be created.

Within the context of my actual usage, then the answer to your question is No, sometimes I want it created, and sometimes I don't because some other build operation failed, as I now explain (since you seem to be asking):

I'm copying a bunch of source code, license files, data files, etc to a directory named "dist".  Once built, I tar it up.   I MAY want to instantiate empty directories under dist.  How do I do that with a build rule?   Here is one way that works just fine:

    Command("dist/test/output", "/usr/bin/ls", Mkdir("$TARGET"))

I.e., just pass it the name of some random file anywhere in the system as a source, but that's just weird.  Surely there's a less obtuse way.

Now to get back to your question I don't want ANY of these file copies (or directory instantiations) to take place until after all the tests in my test directory (named "test") have run.  I enforce that with this one directory level Dependency:

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

So the Command builder that uses the Mkdir Action DOES actually have a dependency:  it depends on every target under directory "test", but I think it cleaner to declare these dependencies with the single Depends line above rather than pass Dir("test") as a declared dependency for each individual file copy and directory instantiation.

I also want to be clear that everything in my scripts currently seems to work just fine, I'm just looking for a way to instantiate a build rule for a directory creation that doesn't look so dad gum strange.

I hope
this contextual information helps.

I'm still an scons noob.  If you think my whole approach to creating a distribution is misguided, feel free to suggest an alternative.

Thanks,
Matt



________________________________
From: Bill Deegan <bill at baddogconsulting.com>
To: M Busche <spammymatt94 at yahoo.com>; SCons users mailing list <scons-users at scons.org>
Sent: Tuesday, January 29, 2013 12:01 PM
Subject: Re: [Scons-users] How to create a build rule for a target with no sources


Matt,


On Tue, Jan 29, 2013 at 8:06 AM, M Busche <spammymatt94 at yahoo.com> wrote:

I'm building up a software distribution package and I want to force the creation of an empty directory under my generated distribution directory.

>

>

>

>I have two questions:

>

>

>1.  Is this the simplest way to instantiate a build rule for directory d?

>

>

>

>Command("d", "s", Mkdir("$TARGET"))

>

>

>2.  What if there is no dependency "s", but I'd still like "d" created as a build target?  What should I be passing for the source parameter?

>


Do you always want it to try to create the directory?
(If you have no source node, then it's always going to be created)

-Bill



_______________________________________________
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/20130129/786687ec/attachment-0001.htm>


More information about the Scons-users mailing list