scons: derived but source files

My build process consists of several steps. One of the intermediate files is actually intended to be edited by the user. But I noticed that when user changes the file, SCons doesn't re-generate the rest of the build chain.

After diving into the problem, I found what's wrong. My expectations were wrong. The signature of an intermediate file is derived from the signatures of the source files and build steps. Content of intermediate files doesn't affect the signature.

Therefore, the problem was reformulated. My task was to force SCons to respect the content of the specific file. I haven't found easy solution. Finally, I produced the following code:

import SCons.Node.FS
class DerivedButSourceFile(SCons.Node.FS.File):
  def calc_signature(self, calc=None):
    s = self.calc_bsig(calc)
    if self.rexists():
      s = s + '_' + self.calc_csig(calc)
    return s

...

# env is an environment object
some_file_node = env.fs.Entry('some_file', klass=DerivedButSourceFile)
Categories: consodoc

Updated: