[Scons-users] Double backslashes in $SOURCE while using a TempFileMunge

Andreas Schmidl andreas.schmidl at gmail.com
Fri Aug 23 11:15:25 EDT 2013


Hello!

Currently I'm integrating a crossplatform toolchain into scons. I would
like to use it for building libraries and elf files for an embedded
system. Because I have to many objects which should be packed in one
library with the helb of ar, I would like to use the TempFileMunge
method of scons. The temp file, which is generated by the TempFileMunge
class of scons uses in the pathes to the objects only one \ (backslash).
But ar expects that backslashes are escaped with two backslashes.

One example:
Temp-File is generated like this: -r -s c:\o1.o c:\o1.o ...

It should be: -r -s c:\\o1.o c:\\o1.o ...

I temporary modified the TempFileMunge class whith the following statement:
args = [a.replace('\\', '\\\\') for a in args]

Now the content which is written into temp-file has \\ instead of \.

But for me that's only a temporary solution, because I wouldn't like to
modify the scons source code. In my opinion the more elegant way is to
modify the env['ARCOM'] variable.

Currently it looks like the following to "enable" the usage of
TempFileMunge:
${TEMPFILE('$AR $ARFLAGS $TARGET $SOURCES')}"

I tried to move the replace operation which is currently located in the
TempFileMunge class to the env['ARCOM'] variable. It looks like this:
"${TEMPFILE('$AR $ARFLAGS $TARGET [a.replace('\\', '\\\\') for a in
$SOURCES]')}"

But this is an invalid expression. (Reported by python). Is it possible
to write such a replace statement into an scons environment variable?

Best regards,
Andreas



More information about the Scons-users mailing list