Re: AddPostAction memoization problem
Bill Deegan <[email protected]> Mon, 27 May 2024 16:02:54 -0700
| Newsgroups | gmane.comp.programming.tools.scons.user |
|---|---|
| Message-ID | <CAEyG4CHvT8Hm1Tw4C8gpiYP52QAi2P=6yW7ykfR3D-65Siub4Q@mail.gmail.com> |
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 <[email protected]> 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 > [email protected] > https://pairlist4.pair.net/mailman/listinfo/scons-users > _______________________________________________ Scons-users mailing list [email protected] https://pairlist4.pair.net/mailman/listinfo/scons-users