Cannot write variable names with the SubstFile builder

Werner Reisberger <[email protected]>
Newsgroups gmane.comp.programming.tools.scons.user
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.