Re: AddPostAction memoization problem
Mike Haboustak <[email protected]> Wed, 29 May 2024 17:27:58 -0400
| Newsgroups | gmane.comp.programming.tools.scons.user |
|---|---|
| Message-ID | <CAMGCZSnep+OgHgaZ3tCsUn2Ecs=Me2yta3AYC9rZ710=EGbXNQ@mail.gmail.com> |
On Wed, May 29, 2024 at 9:49 AM Mats Wichmann <[email protected]> wrote: > > I'd personally agree as to correct behavior: if a step that makes > changes has completed, information related to the node should be up to > date and not old. I guess it's worth mentioning that the getsize() > method isn't *officially* exposed as a public interface, it's possible > there was an actual reason for that back in the mists of time. > Is it true that a function isn't officially exposed if it doesn't have a docstring in the API docs? The documentation includes SCons.Node.FS.File.get_size() right next to get_relpath(). https://scons.org/doc/latest/HTML/scons-api/SCons.Node/#SCons.Node.FS.File.get_size > It should be sufficient to just remove the memoized 'stat', since it's > the thing that holds information SCons itself doesn't update - it > eventually comes from an os.stat() call - that could be considered > "expensive" and thus worth memoizing. I think exists() and rexists() need to be cleared as well. The get_size() call returns -1 because the file didn't exist when the Builder was executed. It never tries to get the current value rfile().getsize() > Stepping aside from the internal implementation questions, you could in > this particular case do something that sidesteps the memoized stat > structure, like: > > print("PostAction:", os.path.getsize(target[0].abspath)) This does work, and it's the same work-around we implemented. I was just trying to use the SCons object model and API functions as much as possible. _______________________________________________ Scons-users mailing list [email protected] https://pairlist4.pair.net/mailman/listinfo/scons-users