Re: Python version dependencies in pkg

From: Tatsuki Makino <tatsuki_makino_at_hotmail.com>
Date: Sat, 08 Oct 2022 04:36:58 UTC
Shane Ambler wrote on 2022/10/04 15:49:
> On 3/10/22 2:06 pm, Tatsuki Makino wrote:
>> # make -C /usr/ports/multimedia/libopenshot/ install FLAVOR=py310
>> ===>  py310-libopenshot-0.2.7_4 Unknown flavor 'py310', possible flavors:
>> py39.
>> *** Error code 1
> 
> That error indicates a flavour that is not supported. For example a port
> specifying USES=python:3.9 means py39 is the only supported flavor so
> building with py310 would fail. USES=python:3.8-3.10 would build for
> py39 and py310 but fail for py311
> 
> So it isn't an option you can set globally, you only use it to build one
> flavour of the one port at a time, although you can set it in env so
> that it carries through to install deps that require and support the
> same flavour. Useful when first creating a port, sometimes for new
> versions, after that you use poudriere to test build all available
> flavours.

This is the behavior that causes the difference between USE_PYTHON=allflavors and -D BUILD_ALL_PYTHON_FLAVORS, which I am relentlessly :) repeating.
Specifically here: https://cgit.freebsd.org/ports/tree/Mk/Uses/python.mk?id=7d48381cbd686ee8d77871bc25cf1e926a314f85#n414
If the above variables are not defined here, FLAVORS will be narrowed down to only the PYTHON{,[23]}_DEFAULT flavors.
Currently _PYTHON_ARGS defaults to 3.7+, so only py39 remains.
If FLAVOR that does not exist in FLAVORS is specified, IGNORE is defined here.
https://cgit.freebsd.org/ports/tree/Mk/bsd.port.mk?id=b74ed0f79d32e7564969faac41a2e1083bbc49f4#n1474

> Instead of building flavours, you can use pkg to install all flavours
> that are available in the pkg repo.
> 
> pkg search numpy
> 
> pkg install py38-numpy py39-numpy

Thus, py-numpy is USE_PYTHON=allflavors, so all FLAVOR packages exist, but only py39- packages are made for those that are not allflavors.
For poudriere, to remove that restriction, write BUILD_ALL_PYTHON_FLAVORS= in /usr/local/etc/poudriere.d/*make.conf.
Then, once the bulk of category/usespythonport@py310 by poudriere is started, all the necessary py310-packages can be made.
poudriere bulk -j jail multimedia/openshot@py310

And, my this part
>> Next.
>> As long as FLAVOR was only used for Python, there was no problem.
>> But now FLAVOR has the following just for what I know.
>> devel/llvm-devel, editors/emacs, graphics/evince, graphics/gpu-firmware-*-kmod... and what else was there? :)
>> I don't know if the make variable FLAVOR is something that can have more than one FLAVOR in it.
>> Python and PHP seem to have a part where it puts the FLAVOR for itself into another variable like PY_FLAVOR or PHP_FLAVOR.
>> However, sometimes FLAVOR is used without considering the possibility that it may contain unrelated FLAVOR or multiple FLAVORs in other cases.

As another example, I am building evince-lite (graphics/evince@lite) and my question is what if evince starts requiring llvm-devel to build it?
I think it is just a matter of writing BUILD_DEPENDS=llvm-config-devel:devel/llvm-devel@default
However, in that case, I think the variable FLAVOR would no longer be something the user is allowed to touch.

I'm not sure :) I don't know if I explained it well :)
I think I'm not derailing from one of the original questions of this topic, about the python version being only 3.9 :)

Regards.