[Scons-users] AddPostAction memoization problem
Mike Haboustak
haboustak at gmail.com
Thu May 23 21:58:50 EDT 2024
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20240523/6ff54652/attachment.htm>
More information about the Scons-users
mailing list