[Scons-users] Mark existing file as up-to-date

William Blevins wblevins001 at gmail.com
Thu May 8 17:53:25 EDT 2014


Can you explain why the build action is changing (IE. The reason scons is
rebuilding the target in question?

V/R,
William
On May 8, 2014 5:33 PM, "Pedro Inácio" <pedromiragaia at gmail.com> wrote:


> I am using SCons for data processing.

> One of the perks is that, unlike traditional compilation projects, each

> file in my project might have required several hours to compute.

> Re-building existing files is, in general, not acceptable.

>

> Therefore, the problem is simple to state.

> While I develop the SCons script, files which have been previously

> processed, for one reason or another are flagged by SCons as requiring

> re-build.

> I would like to tell SCons that the existing files are up-to-date and do

> not require being rebuilt.

> How can I do that?

>

> This could be easily done with make simply issuing "make --touch", however

> this is not straightforward with SCons.

> I have tried to use the Touch factory of SCons to mark existing files as

> up-to-date, but this does not work.

>

> My approach is as follows.

> I added a custom option '--set-uptodate' which call the Touch factory if

> the file already exists:

> (...)

> if GetOption('set-uptodate') and path.isfile(str(OUT)):

> # do not recompute the file it already exists

> Command(OUT,[],Touch("$TARGET")

> else:

> # normal build command

> Command(OUT,IN,"foo $SOURCE > $TARGET")

> (...)

>

> If some files are undesirably flagged as out-of-date, I can issue,

>

> scons --set-uptodate (opts) ...

>

> which works fine and builds everything without recomputing any existing

> files.

>

> However, the next time I run scons without this option,

>

> scons --debug=explain

>

> the same files will be flagged as out-of-date with the reason that,

>

> scons: rebuilding OUT because build action changed:

> old: Touch("$TARGET")

> new: foo $SOURCE > $TARGET

>

>

> Any ideas?

>

>

> _______________________________________________

> 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/20140508/9106452f/attachment.htm


More information about the Scons-users mailing list