[OE-core] [PATCH] python-setuptools.inc: avoid using += with an over-ride

Andre McCurdy armccurdy at gmail.com
Wed Jul 4 05:06:00 UTC 2018


On Tue, Jul 3, 2018 at 8:15 PM, Christopher Larson <kergoth at gmail.com> wrote:
> On Tue, Jul 3, 2018 at 5:55 PM Andre McCurdy <armccurdy at gmail.com> wrote:
>>
>> An over-ride replaces the original value regardless of whether or
>> not it's set up with +=. As replacing the original value seems to be
>> the intention here, drop the += to make it more explicit. Also some
>> minor recipe formatting tweaks.
>>
>> Signed-off-by: Andre McCurdy <armccurdy at gmail.com>
>
> Technically this is not the case, not precisely. += is appending to any
> existing DEPENDS_class-native value, and only *then* is the override applied
> to replace DEPENDS. So it's not appending to DEPENDS, it's appending to
> DEPENDS_class-native.

Yes, that's what I said, or at least tried to. It doesn't matter if
you assign to the over-ride directly or use += to append to it... it's
still an over-ride which completely replaces the original value.

> In this case, it's most likely doing it this way in
> the .inc so it's possible for the recipe including it to define
> DEPENDS_class-native alongside DEPENDS before the inclusion, but this is
> largely pointless, since they can always += to it *after* the inclusion
> instead. So I think you're good, most likely it's still fine to remove it,
> but I wanted to clarify, as there *are* times when this is a useful thing to
> do.

Right. I did look into the recipe, the include and the various classes
it uses fairly carefully and I'm pretty sure this is the right fix.

As to whether allowing += with an over-ride is a useful feature of the
language I'm not sure. There are other ways to achieve the same result
but it's a huge trap for new users who assume that it behaves like a
conditional append - I've seen that bug many times.

> --> Christopher Larson
> kergoth at gmail dot com
> Founder - BitBake, OpenEmbedded, OpenZaurus
> Senior Software Engineer, Mentor Graphics



More information about the Openembedded-core mailing list