[PATCH] eng: Add build system chapter

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Nov 12 06:05:51 UTC 2019



On 11/11/2019 23:29, Chris Johns wrote:
> On 11/11/19 8:45 pm, Sebastian Huber wrote:
>> On 08/11/2019 23:48, Chris Johns wrote:[...]
>>> 3. Is the ${} expansion something you have implemented? It is a nice feature.
>> [...]
>>
>> With standard Python the substitution itself is a one liner:
>>
>>      def substitute(self, ctx, value):
>>          if isinstance(value, str):
>>              try:
>>                  return Template(value).substitute(ctx.env)
>>              except Exception as e:
>>                  ctx.fatal(
>>                      "In item '{}' substitution in '{}' failed: {}".format(
>>                          self.uid, value, e
>>                      )
>>                  )
>>          return value
>>
> 
> Does this support nested defines?

You mean something like this:

Python 2.7.14 (default, Oct 12 2017, 15:50:02) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import string
 >>> d={"a":"x","b":"y","c":"${a}${b}"}
 >>> t=string.Template("${c}")
 >>> t.substitute(d)
'${a}${b}'
 >>>

?

Apparently, the Template.substitute() doesn't work recursively.

The variables used for the substitution are the configuration set 
environment variables. I intentionally didn't add a recursive 
substitution since you should specify the variable definitions in a 
proper order.

> 
> The RSB and rtemstoolkit macros recursively expand as it was a something I found
> needed and useful ...
> 
> https://git.rtems.org/rtems-tools/tree/rtemstoolkit/macros.py#n471

I think we should keep it simple in the build system right now. If there 
is a real need, then we can have a look at this.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.


More information about the devel mailing list