[Scons-users] behaviour of '-c' if targets include a directory being built/filled

Arndt Pauschardt arndt.pauschardt at web.de
Mon Feb 17 11:11:33 EST 2020


Dear SCons community

I have an emitter which adds a Dir node to the list of targets, like this:
def emit_sometools_out_dir(target, source, env):
  """ target[0] is a file (node) which acts as the log file.
  We add a dir (node) which holds all the other data produced by SOMETOOL
  """
  result_dir_str, _ = os.path.splitext(os.path.basename(str(target[0])))
  result_dir = target[0].Dir(result_dir_str)
  return target + [result_dir], source

The corresponding builder works fine in the sense that both 'targets' are produced - a log file "target[0]" and directory "target[1}" with all the other data produced by the tool.

If I run "-c" on the target of such builder, only the target log file is removed, the Dir (and its contents) are kept.
I would have expected that also the Dir (and its content) is removed on '-c'.
In order to have also the Dir (and its content) removed, I need to add a Clean() for the Dir (that is, target[1] as returned by the emitter)

Is this behaviour intended?
I can't find an explicit statement in the manual that says "-c is removing both files and dirs", but reading through it seems to suggest that it does remove files and dirs.

Thx
Arndt



More information about the Scons-users mailing list