[Scons-users] help with deleting or cleaning files
Mats Wichmann
mats at wichmann.us
Sun Sep 27 15:38:41 EDT 2020
On 9/27/20 12:15 PM, Damien wrote:
> 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.
I'd take the message seriously: something is None when you're not
expecting it. Tracing that down (some print statements, maybe) should
help you figure out if you're accessing things that aren't defined for
the buildtype you're doing and that's why they're None, or whether some
step got missed somewhere.
More information about the Scons-users
mailing list