Can a single recipe .bb file be used to generate both Python2 and Python3 packages?
Robert P. J. Day
Strange request earlier this week -- I was asked how *one* Python
recipe file could be used to generate both Python2 and Python3
packages to be installed in the final image.
I had never heard of such a thing, but the colleague asking this
was convinced she had seen this before somewhere (but couldn't
My immediate response was that the standard approach was to define
two recipe files -- say, python-fubar.bb and python3-fubar.bb --
where the entire difference was "inherit setuptools" in the former
and "inherit setuptools3" in the latter.
I mentioned that it used to be common to have just that, and for
both recipes to then include all the common content in the file
"python-fubar.inc" (I do see how a couple folks are cleaning all
that up since, if there is now only the Python3 version being
supported, it's pointless to still have a ".inc" file).
I asked if that is what she was thinking of, but she was adamant
that she remembers a single recipe .bb file that could do this.
Is there such a thing? I suspect one could hack something up,
but is such an approach considered standard? Or even doable?
Rob Prowel <rprowel@...>
On 12/20/20 8:46 AM, Robert P. J. Day wrote:
I asked if that is what she was thinking of, but she was adamantDoable? Yes...Smart to do? IMHO, absolutely not.
With the recipe class methods that accomplish each stage of the build you can customize them any way you want, but at the expense of maintaining clear intent and keeping it maintainable.
Your initial approach of using common includes and a heirarchical inheritance for separate recipes makes more sense.
Robert P. J. Day
On Sun, 20 Dec 2020, Rob Prowel wrote:
On 12/20/20 8:46 AM, Robert P. J. Day wrote:i suspected as much, i just wanted to confirm there was noI asked if that is what she was thinking of, but she was adamantDoable? Yes...Smart to do? IMHO, absolutely not.
super-clever way to do this.