[Scons-users] bypass string interpolation (quoting)

Neal Becker ndbecker2 at gmail.com
Fri Jun 10 15:16:40 EDT 2016


following this example:

ttps://stackoverflow.com/questions/7159612/scons-prevent-text-expansion-in-
construction-variable

I found this solution:
env['RPATH'] = [NDARRAYLIBPATH, BOOSTLIBPATH, PYTHON_LIBDIR, Literal('\'' + 
':'.join(['$$ORIGIN/' + x for x in MKLPATH.split(':')]) + '\'')]

Note that directly setting this using Environment (RPATH = ...) doesn't 
work, giving an error message:

scons: *** [mkl.cpython-35m-x86_64-linux-gnu.so] TypeError `__str__ returned 
non-string (type generator)' trying to evaluate `${_concat(RPATHPREFIX, 
RPATH, RPATHSUFFIX, __env__)}'

The quoting situation is pretty ugly IMO

Neal Becker wrote:

> Thinking that maybe I need to just use Literal, I tried:
> 
> MKLRPATH = [Literal(r'$ORIGIN/' + x for x in MKLPATH.split(':'))]
> 
> then setting:
> Envirnonment(...
>  RPATH=[NDARRAYLIBPATH, BOOSTLIBPATH, MKLRPATH , PYTHON_LIBDIR])
> 
> gives:
> scons: *** [mkl.cpython-35m-x86_64-linux-gnu.so] TypeError `__str__
> returned non-string (type generator)' trying to evaluate
> `${_concat(RPATHPREFIX, RPATH, RPATHSUFFIX, __env__)}'
> 
> Jason Kenny wrote:
> 
>> Hi,
>> 
>> I set this value in Parts via using env.Literal()
>> 
>> This should allow the value to be left untouched by SCons subst() engine.
>> 
>> Jason
>> 
>> -----Original Message-----
>> From: Scons-users [mailto:scons-users-bounces at scons.org] On Behalf Of
>> Neal Becker
>> Sent: Friday, June 10, 2016 1:20 PM
>> To: scons-users at scons.org
>> Subject: [Scons-users] bypass string interpolation (quoting)
>> 
>> I need an environment containing
>> RPATH=[MKLPATH])
>> 
>> where MKLPATH = '$ORIGIN/...'
>> 
>> currently scons chokes on this, because it tries to expand (interpolate)
>> the
>> $ORIGIN.  I can't figure out how to quote this to bypass the expansion.
>> 
>> 
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> 
> 
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users




More information about the Scons-users mailing list