Many years ago, I integrated the IconSvgRenderer (written by Joel Holdsworth) directly into the SCons build by means of a custom builder with an ''emitter function''. The build as such works fine and automatically determines which icons can be generated from a given SVG source. However, those SVG icons tend to be rebuilt very frequently, even while none of the SVG sources has changed. Basically this was more of an annoyance, since we have now about 15 icons and the rendering is really fast ... it is just ugly, especially on incremental builds (and it could become a problem once we have a massive amount of graphics to process. So I took the opportunity to take close look now, since I am doing uninspiring clean-up work since several weeks now. But that problem turned out to be quite insidious and hard to spot. First, AI set me off into a completely wrong angle, since it is ''not'' caused by a missing string representation of the custom Action class. However, from there I went to watching the target checks with the debugger, and this eventually got me to realise, that SCons mistakenly detects a change in the Executor / the Action class. The root cause is, that we invoke Python code from an external Module, IconSvgRenderer.py, and this is »materialised« by SCons automatically into a string representation, which includes memory addresses of functions in that module. And that yields a signature, that is, quite obviously, not stable, even while you end up sometimes with loading the code to the same memory location. As a solution / workaround, we now subclass the standard implementation from SCons and override the signature function; instead of fingerprinting the binary code, we just compute a MD5 over the python source file, which can be easily achieved with the help of the File-Node from SCons. Essential resources: https://scons.org/doc/4.8.0/HTML/scons-user.html#chap-builders-writing ...and the Reference / Manpage of SCons https://scons.org/doc/4.8.0/HTML/scons-man.html#action_objects SCons/Action.py SCons/Node/__init__.py
10 MiB
10 MiB
| The file is too large to be shown. |