[Scons-users] help with deleting or cleaning files

Damien damien at khubla.com
Sun Sep 27 14:15:01 EDT 2020


All,

As part of our installers, we put a set of dlls (or so's) into a 
directory, to go into one of our products. Because of the way this 
product is shipped, the dlls go into a directory that's not debug or 
release, it just has the binaries. When we're doing debug builds and 
testing, the debug dlls go into that directory and when we're doing 
release testing, the release versions go in there. I'd like to automate 
removing the debug dlls if we do a release build and vice versa, right 
now we do that by hand, which is silly.

I thought we could do this with env.Clean(...) but that appears not to 
be the case. Here's a cut down example in an SConscript:

dbgfilelist  [
          'concrt140d.dll',
          'msvcp140d.dll',
          'vccorlib140d.dll',
          'vcomp140.dll',
          'vcruntime140d.dll'
       ]

relfilelist = [
          'concrt140.dll',
          'msvcp140.dll',
          'vccorlib140.dll',
          'vcomp140.dll',
          'vcruntime140.dll'
       ]

if thisenv['BUILDTYPE'] == 'DEBUG':
       thisenv['INSTALLDIR'] = thisenv['BINDIR'] + 
'/../../interfaces/binaries/x64'
       releaseclean = thisenv.Clean(thisenv['INSTALLDIR'], [x for x in 
relfilelist])
       releaseinstall1 = thisenv.Install(thisenv['INSTALLDIR'], 
[os.path.join(thisenv['BINDIR'], x) for x in dbgfilelist])
       Default(releaseclean + releaseinstall1)
else:
       thisenv['INSTALLDIR'] = thisenv['BINDIR'] + 
'/../../interfaces/binaries/x64'
       debugclean = thisenv.Clean(thisenv['INSTALLDIR'], [x for x in 
dbgfilelist])
       debuginstall1 = thisenv.Install(thisenv['INSTALLDIR'], 
[os.path.join(thisenv['BINDIR'], x) for x in relfilelist])
       Default(debugclean + debuginstall1)

When I try this, SCons says: TypeError: unsupported operand type(s) for 
+: 'NoneType' and 'list': for the Default setup. I always thought you 
could just add Actions but obviously I'm doing something wrong.

If this is the wrong way to use Clean, can someone demonstrate how to do 
this with Command and Delete? The full file list has 15 or so binaries, 
so I'd like to do it with a list rather than line by line.

Damien



More information about the Scons-users mailing list