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

Bill Deegan bill at baddogconsulting.com
Tue Jan 25 15:00:54 EST 2022


Pretty sure $$ will yield $
Give that a try.

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', 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20220125/47aeb547/attachment-0001.htm>


More information about the Scons-users mailing list