After FLAVORS introduction, I've discovered that even though I have
DEFAULT_VERSIONS+= python=3.6 python3=3.6
in my /etc/make.conf, py27 ports are still built by default.
% make -V DEFAULT_VERSIONS python=3.6 python3=3.6 pgsql=10 ssl=libressl % make -C /usr/ports/www/py-flask -V FLAVORS -V FLAVOR py27 py36 py27
Seems that default flavor is chosen incorrectly in python.mk. While
_VALID_PYTHON_VERSIONS is filled correctly, taking PYTHON_DEFAULT,
PYTHON2_DEFAULT, PYTHON3_DEFAULT in that order and avoiding duplicates
in the resulting set, FLAVORS filled the similar way is filled
incorrectly:
# Decide how many flavors we want. By default, only generate the default
# versions.
. if defined(BUILD_ALL_PYTHON_FLAVORS) || defined(_PYTHON_FEATURE_ALLFLAVORS)
FLAVORS= ${_ALL_PYTHON_FLAVORS}
. else
. for _v in ${PYTHON3_DEFAULT} ${PYTHON2_DEFAULT} ${PYTHON_DEFAULT}
_f= py${_v:S/.//}
. if ${_ALL_PYTHON_FLAVORS:M${_f}} && !${FLAVORS:M${_f}}
FLAVORS:= ${_f} ${FLAVORS}
. endif
. endfor
. endif
. if !empty(FLAVORS) && empty(FLAVOR)
FLAVOR= ${FLAVORS:[1]}
. endif
.endifThat code will ignore PYTHON_DEFAULT if the value it's set was
already met in PYTHON3_DEFAULT or PYTHON2_DEFAULT, and that's practically
always the case. IMO it should use the same logic as _VALID_PYTHON_VERSIONS
does, however to keep the change minimal, I'm just fixing the logic here:
since defaults are traversed in reverse order, always move the next
flavor to the beginning of the list.