Re: Python version dependencies in pkg

From: Shane Ambler <FreeBSD_at_ShaneWare.Biz>
Date: Sun, 02 Oct 2022 03:27:53 UTC
On 30/9/22 4:37 pm, Tatsuki Makino wrote:
> Shane Ambler wrote on 2022/09/30 13:54:
>> On 30/9/22 7:05 am, Tatsuki Makino wrote:
>>> Currently, two versions of Python are allowed to be installed on FreeBSD.
>>> One is Python 2.7 but EOL.
>> You can install as many python major versions as you want or need, that
>> means you can also install many of the py modules for each version. Note
>> that some have conflicts and some only need concurrent option added to
>> them to prevent conflicts.
>> Being the maintainer of some py modules, I have them all installed so
>> I can verify that all py versions build and install without conflict.
> Yes, we need to consider with regard to conflicts.
> But it is difficult to cause conflicts unless we go the extra way.
> Because...
> USES=python means USES=python:3.7+. It is so by default value of _PYTHON_ARGS.
> If we want to use 2.7, we need to deliberately make them use it.
> And there is only one FLAVOR for Python, the default version.
> This can be checked with a command like the following
> make -C /usr/ports/multimedia/libopenshot/ -V USE_PYTHON:Mallflavors -V FLAVORS
> This means that it is not possible to propagate FLAVOR other than the default version.
> No packages other than the default version will be created.

While making or updating a port, I build and install for each flavour
before testing with poudriere

make FLAVOR=py38 stage-qa install clean
make FLAVOR=py39 stage-qa install clean
make FLAVOR=py310 stage-qa install clean

I find that this doesn't carry through to dependencies so I end up
setting FLAVOR in the env

setenv FLAVOR py310; make stage-qa install clean

and bash would be - export FLAVOR=py310; make install

This also works for non-py flavours

cd devel/binutils
make FLAVOR=aarch64 install
make FLAVOR=arm_none_eabi install
make FLAVOR=mingw32 install

> It is USE_PYTHON=allflavors that allows the use of FLAVOR other than the default version.
> Such a port will produce multiple FLAVORs with the following command.
> make -C /usr/ports/math/py-numpy/ -V USES:Mpython\* -V USE_PYTHON:Mallflavors -V FLAVORS
> The results will vary depending on the version range.
> make -C /usr/ports/math/py-numpy/ -V USES:Mpython\* -V USE_PYTHON:Mallflavors -V FLAVORS USES=python:2.7-3.8
> ...
> Conflicts can only happen intentionally.

conflicts with python modules happen when installing files into the same
place, such as adding cli commands to ../bin or installing docs, the
concurrent option adds a flavour suffix to resolve most conflicts

FreeBSD - the place to B...Software Developing

Shane Ambler