Note that there are some explanatory texts on larger screens.

plurals
  1. POSCons does not clean all files
    primarykey
    data
    text
    <p>I have a file system containing directories of "builds", each of which contains a file called "build-info.xml". However some of the builds happened before the build script generated "build-info.xml" so in that case I have a somewhat non-trivial SCons SConstruct that is used to generate a skeleton build-info.xml so that it can be used as a dependency for further rules.</p> <p>I.e.: for each directory:</p> <ul> <li>if build-info.xml already exists, do nothing. More importantly, do not remove it on a 'scons --clean'.</li> <li>if build-info.xml does not exist, <strong>generate</strong> a skeleton one instead - build-info.xml has no dependencies on any other files - the skeleton is essentially minimal defaults.</li> <li>during a --clean, remove build-info.xml if it was <strong>generated</strong>, otherwise leave it be.</li> </ul> <p>My SConstruct looks something like this:</p> <pre class="lang-python prettyprint-override"><code>def generate_actions_BuildInfoXML(source, target, env, for_signature): cmd = "python '%s/bin/create-build-info-xml.py' --version $VERSION --path . --output ${TARGET.file}" % (Dir('#').abspath,) return cmd bld = Builder(generator = generate_actions_BuildInfoXML, chdir = 1) env.Append(BUILDERS = { "BuildInfoXML" : bld }) ... # VERSION = some arbitrary string, not important here # path = filesystem path, set elsewhere build_info_xml = "%s/build-info.xml" % (path,) if not os.path.exists(build_info_xml): env.BuildInfoXML(build_info_xml, None, VERSION = build) </code></pre> <p>My problem is that 'scons --clean' does not remove the generated build-info.xml files.</p> <p>I played around with env.Clean(t, build_info_xml) within the 'if' but I was unable to get this to work - mainly because I could not work out what to assign to 't' - I want a generated build-info.xml to be cleaned unconditionally, rather than based on the cleaning of another target, and I wasn't able to get this to work.</p> <p>If I tried a simple env.Clean(None, "build_info_xml") after but outside the 'if' I found that SCons would clean every single build-info.xml file including those that weren't generated. Not good either.</p> <p>What I'd like to know is how SCons goes about determining which files should be cleaned and which should not. Is there something funny about the way I've used a generator function that prevents SCons from recording this target as a Clean candidate?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload