[Scons-users] turning off directory creation?

Robert Zeigler robert.zeigler at gmail.com
Tue Apr 30 09:36:34 EDT 2013


The real command creates the directory structure (and the target). The problem is the real command, unfortunately, depends on at least part of the directory structure NOT existing when it begins to run. The real command looks more like:

Command(["a/b/c.txt"],["e/f/g.txt"], "buildc $SOURCE")

And, unfortunately, "buildc" needs to start with a clean state, i.e. "a" can't exist when buildc runs, or else buildc will fail.
But scons auto-creates a/b before ever running "buildc $SOURCE".

As I said, long-term, reworking "buildc" to allow for pre-existing directory structures is the "right" solution; and my current dirty hack is along the lines of:

Command(["a/b/c.txt"],["e/f/g.txt"], "rm -rf a && buildc $SOURCE")

I'm just wondering if there is a way to make scons NOT create a/b before calling buildc.

Robert


On Apr 30, 2013, at 4/308:08 AM , Gary Oberbrunner <garyo at oberbrunner.com> wrote:


>

>

>

> On Tue, Apr 30, 2013 at 9:03 AM, Robert Zeigler <robert.zeigler at gmail.com> wrote:

> I'm in the process of converting a make-based build to an scons one. One of the programs called during the build generates a set of targets in a particular directory structure. It creates this directory structure itself and, as currently written, won't work correctly if that directory structure already exists. However, it appears that scons automatically creates directories when a target is a directory path (see example at end of e-mail). I've worked around the problem for now by forcing the build to remove the destination directory, but that's an ugly hack. Long-term, the solution is to rework the underlying code to be more intelligent about handling existing directory structures, but there simply isn't time to do that right now. Is there a way to turn off scons's default "create non-existent target directory structure" behavior? I've googled this for the past day to no avail.

>

> Thanks!

>

> Robert

>

> SConstruct:

> Command(["foo/bar/baz.txt"],[],"echo noop")

>

> terminal:

>

> rm -rf foo/

> ls foo

> ls: cannot access foo: No such file or directory

> scons

> scons: Reading SConscript files …

> scons: done reading SConscript files.

> scons: Building targets …

> echo noop

> noop

> scons: done building targets.

>

> ls foo

> bar

>

> You'd like an option that would make the above build just fail? Or are you depending on the fact that the command doesn't actually create the target?

>

> --

> Gary

> _______________________________________________

> Scons-users mailing list

> Scons-users at scons.org

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




More information about the Scons-users mailing list