[Scons-users] Cannot write variable names with the SubstFile builder

Werner Reisberger wr at pure.ch
Wed Jan 26 08:53:06 EST 2022


On 2022-01-25 21:00, Bill Deegan wrote:
> Pretty sure $$ will yield $
> 
> Give that a try.

That's working perfect. Thanks!

--Werner

> On Tue, Jan 25, 2022 at 8:48 AM Werner Reisberger <wr at pure.ch> wrote:
> 
>> The SubstFile builder always expands variable names an ignores any
>> escapes.
>> 
>> My SConstruct is:
>> 
>>    env = Environment(tools=['default'])
>>    env['prefix'] = '/usr/bin'
>>    script_dict = {'@prefix@': '/bin', '@exec_prefix@': '$prefix
>> and
>> "${RPM_BUILD_ROOT}"'}
>>    env.Substfile('script.in [1]', SUBST_DICT=script_dict,
>> SUBSTFILESUFFIX='.spec')
>> 
>> The expected content in script.spec should be:
>> 
>>    prefix:      /bin
>>    exec-prefix: /usr/bin and "${RPM_BUILD_ROOT}"
>> 
>> However I am getting:
>> 
>>    prefix:      /bin
>>    exec-prefix: /usr/bin and ""
>> 
>> Whatever I try with backslashes doesn't give me the expected
>> result. The
>> closest I am coming is
>> 
>>    '@exec_prefix@': '$prefix and "${RPM_BUILD_ROOT}" ==>
>> exec-prefix:
>> /usr/bin and "${RPM_BUILD_ROOT}"
>> 
>> Seems to be a bug for me. Luckily I could replace ${RPM_BUILD_ROOT}
>> with
>> %{buildroot} which has the same value in a RPM spec file.
>> 
>> --Werner
>> 
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users [2]
> 
> 
> Links:
> ------
> [1] http://script.in
> [2] 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