[Scons-users] AddPostAction memoization problem
Bill Deegan
bill at baddogconsulting.com
Mon May 27 19:02:54 EDT 2024
Mike,
AddPostAction() adds to the list of Actions for a builder, so when your
action is called the builder in question has not completed.
AddPreAction() adds to a pre list
AddPostAction() adds to a post list
Then when the target is built, the executor will run the actions in this
order pre-list + normal-action-list + post list.
It looks like the memoization is cleared when the builder is called.
But certainly not called between each of the Action()'s in the list of
actions for a builder.
-Bill
On Thu, May 23, 2024 at 6:59 PM Mike Haboustak <haboustak at gmail.com> wrote:
> I encountered a problem recently with AddPostAction and the
> Node.get_size() function. The memoization features of the Node.exists()
> function does not appear to be reset after the Builder completes and before
> the PostAction runs. As a result, some of the cached values are not correct.
>
> Here's a simplified SConstruct that reproduces the issue when run with
> SCons 4.7.0 with GCC on Linux. The "PostAction" size of the test.o object
> file is based on the state of the file prior to the builder running.
>
> ---- SConstruct
> env = Environment()
> def print_size(target, source, env):
> print("PostAction:", target[0].getsize())
>
> test = env.Object("test.c")
> env.AddPostAction(test, Action(print_size))
> ----
>
> Test Output
> ----
> $ touch test.c
> $ scons
> scons: Reading SConscript files ...
> scons: done reading SConscript files.
> scons: Building targets ...
> gcc -o test.o -c test.c
> print_size(["test.o"], ["test.c"])
> PostAction: None
> scons: done building targets.
>
> $ echo -e "\n" >>test.c
> $ scons
> scons: Reading SConscript files ...
> scons: done reading SConscript files.
> scons: Building targets ...
> gcc -o test.o -c test.c
> print_size(["test.o"], ["test.c"])
> PostAction: 800
> scons: done building targets.
> ----
>
> Thanks,
> Mike
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20240527/2b88b366/attachment.htm>
More information about the Scons-users
mailing list