[Scons-users] question regarding env.subst behavior

Bill Deegan bill at baddogconsulting.com
Sun May 24 16:22:54 EDT 2020


Nothing is cached.
If you store a plain string in a env[] var, then it just retrieves it.
If there are $ values in it, it will get evaluated.

On Sat, May 23, 2020 at 7:29 AM daggs <daggs at gmx.com> wrote:

> I've tried to run this:
> env = Environment(data1 = 'abc', data2 = 'xyz')
> env.Append(line = "line: $data1 <=> $data2")
> env.Append(line1 = "line1: " + env.subst('$data1') + " <=> " +
> env.subst('$data2'))
> print("env line = ", env['line'], ", line subst = ", env.subst('$line'))
> print("env line1 = ", env['line1'], ", line subst = ", env.subst('$line1'))
>
> the output is:
> $ scons -Q
> env line =  line: $data1 <=> $data2 , line subst =  line: abc <=> xyz
> env line1 =  line1: abc <=> xyz , line subst =  line1: abc <=> xyz
> scons: `.' is up to date.
>
> if I understand correctly, line is not cached, line1 is, correct?
>
> Dagg.
>
> *Sent:* Saturday, May 23, 2020 at 11:00 AM
> *From:* "daggs" <daggs at gmx.com>
> *To:* scons-users at scons.org
> *Cc:* "SCons users mailing list" <scons-users at scons.org>
> *Subject:* Re: [Scons-users] question regarding env.subst behavior
> Greetings Bill
>
> I build my CC and LD based on other vars (cross compiler), my path
> includes the path for the cc which are based on he same vars as CC.
> also, the same goes for the target and obj vars.
>
> all the vars which build the above are static and do not change while the
> build process is running.
>
> Thanks,
>
> Dagg.
>
> *Sent:* Friday, May 22, 2020 at 11:57 PM
> *From:* "Bill Deegan" <bill at baddogconsulting.com>
> *To:* "SCons users mailing list" <scons-users at scons.org>
> *Subject:* Re: [Scons-users] question regarding env.subst behavior
> Yes. subst() doesn't cache.
>
> Please explain your use model?
> Depending on how you want to use the evaluated string, there may or may
> not be a way to prevent reevaluating it.
>
> On Fri, May 22, 2020 at 1:40 PM daggs <daggs at gmx.com> wrote:
>
>> Greetings,
>>
>> I wanted to as a question regarding env.subst, I remembering reading that
>> when calling env.subst, gets evaluated every time the var is called.
>> I cannot seem to find that link anymore, is that correct?, if so, are
>> there any solutions to prevent such reevaluating by just save the evaluated
>> data inside a var?
>>
>> Thanks,
>>
>> Dagg.
>> _______________________________________________
>> 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
> _______________________________________________
> 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/20200524/f11c603b/attachment.html>


More information about the Scons-users mailing list