USES=python doesn't work correctly under the following situation:
- PY_FLAVOR is incorrectly set to FLAVOR when:
- the port manually specifies FLAVORS
Differential D13449
Fix python flavors and default links dbn on Dec 11 2017, 4:03 PM. Authored by Tags None Referenced Files
Subscribers None
Details USES=python doesn't work correctly under the following situation:
NOTE: the check here is redundant as _PYTHON_VERSION will contain the correct version based on FLAVOR
Diff Detail
Event TimelineComment Actions I assume you are only referring to point 3, as the other two points were not addressed in commit r456026. I think we also disagree on the definition of "really, really, really simpler": Your commit: @@ -567,7 +567,9 @@ RUN_DEPENDS+= cython-${PYTHON_VER}:lang/cython@${PY_FLAVOR} .if defined(_PYTHON_FEATURE_CONCURRENT) _USES_POST+= uniquefiles:dirs -.if ${PYTHON_VERSION} == ${PYTHON_DEFAULT_VERSION} +.if defined(_PYTHON_FEATURE_FLAVORS) && ${FLAVOR} == ${FLAVORS:[1]} +UNIQUE_DEFAULT_LINKS= yes +.elif !defined(_PYTHON_FEATURE_FLAVORS) && ${PYTHON_VERSION} == ${PYTHON_DEFAULT_VERSION} UNIQUE_DEFAULT_LINKS= yes .else UNIQUE_DEFAULT_LINKS= no Note that the above change only fixes UNIQUE_DEFAULT_LINKS if python flavors is used. In the following example it does not work: # cd /usr/ports/Mk # make -f bsd.port.mk -V UNIQUE_DEFAULT_LINKS USES=python:3.3+ USE_PYTHON=concurrent no # make -f bsd.port.mk -V UNIQUE_DEFAULT_LINKS USES=python:3.3+ USE_PYTHON="concurrent flavors" yes Whereas my commit (ignoring some code blocks that were moved around): @@ -567,7 +559,7 @@ RUN_DEPENDS+= cython-${PYTHON_VER}:lang/cython@${PY_FLAVOR} .if defined(_PYTHON_FEATURE_CONCURRENT) _USES_POST+= uniquefiles:dirs -.if ${PYTHON_VERSION} == ${PYTHON_DEFAULT_VERSION} +.if ${PYTHON_VERSION:S/python//} == ${_VALID_PYTHON_VERSIONS:[1]} UNIQUE_DEFAULT_LINKS= yes .else UNIQUE_DEFAULT_LINKS= no How shall we proceed regarding:
Comment Actions Ok, I see what you trying to do. It is by design that the selection of the Python version through flavors is not limited to when python.mk sets FLAVORS, so this is wrong. I will try to think of something for people who use conflicting flavor names. Comment Actions Well, USE_PYTHON=concurrent when you only support one of Python 2 or 3, or without flavors makes absolutely no sense, so the first line is really not a bug in the framework but in the port doing something stupid. So, this part of your patch is also rejected, the framework is not here to make make sure every stupid thing a port can do is handled correctly. I will try to add a DEV_WARNING about it. Comment Actions Is there actually one port that does this ? I was trying to test the DEV_WARNING I was adding, and I could not find any. Comment Actions Interesting, I'm curious as to the design intent. Perhaps allow a port to manuallt override the FLAVORS? Comment Actions I prefer it the way it currently is, it shows in a very simple way where PY_FLAVOR come from. Comment Actions The problem is the way it currently is does not work under some conditions: # cd /usr/ports/Mk # make -f bsd.port.mk -V PY_FLAVOR USES=python FLAVOR=foobar foobar I think there is a trade-off between transparency (clearly showing that PY_FLAVOR comes from FLAVOR) and potential inconsistency (if _PYTHON_VERSION is no longer directly defined by FLAVOR). I naturally prefer preventing the latter, but I do see the value in the former. I have updated the patch to maintain transparency but to fix the issue. |