I have a file system containing the "builds" directories, each of which contains a file called "build-info.xml". However, some of the builds occurred before the build script generated by "build-info.xml" was built, so in this case I have a somewhat nontrivial SCons SConstruct that is used to create the build-info.xml skeleton so that it can be used as a dependency for further rules .
Ie: for each directory:
- If build-info.xml already exists, do nothing. More importantly, do not delete it on "scons -clean".
- if build-info.xml does not exist, generate skeleton code instead - build-info.xml has no dependencies on any other files - the skeleton is essentially the minimum default value.
- during -clean, remove build-info.xml if it was generated , otherwise leave it.
My SConstruct looks something like this:
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 })
...
build_info_xml = "%s/build-info.xml" % (path,)
if not os.path.exists(build_info_xml):
env.BuildInfoXML(build_info_xml, None, VERSION = build)
My problem is that 'scons -clean' does not delete the generated build-info.xml files.
I played with env.Clean (t, build_info_xml) in "if", but I was not able to get it to work - mainly because I could not figure out what to assign to "t" - I need the generated assembly -info.xml, which will be cleared unconditionally, and not based on clearing another goal, and I could not get it to work.
env.Clean(None, "build_info_xml" ) , 'if', , SCons build-info.xml, , . .
, , SCons , , . - , , SCons Clean?