Re: Python version dependencies in pkg

From: Tatsuki Makino <tatsuki_makino_at_hotmail.com>
Date: Mon, 10 Oct 2022 04:11:38 UTC
Shane Ambler wrote on 2022/10/10 12:04:
> On 8/10/22 3:06 pm, Tatsuki Makino wrote:
> 
>> This is the behavior that causes the difference between USE_PYTHON=allflavors and -D BUILD_ALL_PYTHON_FLAVORS, which I am relentlessly :) repeating.
> 
> Notice that valid python versions vary per port -
> 
> % cd /usr/ports/math/py-numpy
> % make -V _PYTHON_VERSIONS -V _PYTHON_VERSION_MINIMUM -V
> _PYTHON_VERSION_MAXIMUM -V _VALID_PYTHON_VERSIONS -V FLAVORS
> 3.9 3.8 3.7 3.10 3.11 2.7
> 
> py-numpy has USES=python:3.8-3.10 which matches that valid list

No, no, no, no :)
math/py-numpy has USE_PYTHON=allflavors defined, so all FLAVORs from 3.8-3.10 are in FLAVORS.

> While -
> % cd /usr/ports/devel/py-six
> % make -V _PYTHON_VERSIONS -V _PYTHON_VERSION_MINIMUM -V
> _PYTHON_VERSION_MAXIMUM -V _VALID_PYTHON_VERSIONS -V FLAVORS
> 3.9 3.8 3.7 3.10 3.11 2.7
(Slightly omitted)
> py38 py27 py39 py37 py310 py311
> 
> py-six has USES=python:2.7+ so all versions are valid

My environment returns following.
I don't know when the porttree is from.
That is at least what I updated on portsnap after October 10, Japanese Standard Time (UTC+09:00). I can't touch it right now because I'm in a chromium build process :)

> make -C /usr/ports/devel/py-six/ -V _PYTHON_VERSIONS -V _PYTHON_VERSION_MINIMUM -V _PYTHON_VERSION_MAXIMUM -V _VALID_PYTHON_VERSIONS -V FLAVORS
3.9 3.8 3.7 3.10 3.11 2.7
2.7

3.9 2.7 3.8 3.7 3.10 3.11
py39 py27

> If your FLAVORS list is shorter than that, maybe you have another
> setting in make.conf causing that. Try removing your make.conf and see
> if you get different values.

The narrowing down of FLAVORS to two is the behavior of Mk/Uses/python.mk that I wrote about in my previous email.
When FLAVORS is three, If it is a mistake in the definition of DEFAULT_VERSIONS=python{,[23]}=, you may get a warning by the string written below.
https://cgit.freebsd.org/ports/tree/Mk/Uses/python.mk?id=7d48381cbd686ee8d77871bc25cf1e926a314f85#n352
And, as the warn message goes, "if you want more Python flavors, set BUILD_ALL_PYTHON_FLAVORS in your make.conf"
If all FLAVOR is visible, the following conditions will have been met
.    if defined(BUILD_ALL_PYTHON_FLAVORS) || defined(_PYTHON_FEATURE_ALLFLAVORS)

Or are there changes that are not included in the porttree I got from portsnap?

Regards.