Index: Mk/Uses/python.mk =================================================================== --- Mk/Uses/python.mk +++ Mk/Uses/python.mk @@ -307,6 +307,12 @@ PYTHON3_DEFAULT_VERSION?= python${PYTHON3_DEFAULT} .endif +.if ${FLAVOR} == python2 +_PYTHON_ARGS= ${PYTHON2_DEFAULT} +.elif ${FLAVOR} == python3 +_PYTHON_ARGS= ${PYTHON3_DEFAULT} +.endif + .if ${_PYTHON_ARGS} == "2" _PYTHON_ARGS= ${PYTHON2_DEFAULT_VERSION:S/^python//} _WANTS_META_PORT= 2 @@ -357,21 +363,42 @@ IGNORE= needs Python ${_PYTHON_VERSION_NONSUPPORTED}, but ${_PV} was specified .endif # defined(PYTHON_VERSION) || defined(PYTHON_CMD) .undef _PYTHON_VERSION +.undef _VALID_PYTHON_VERSIONS .for ver in ${PYTHON2_DEFAULT} ${PYTHON3_DEFAULT} ${_PYTHON_VERSIONS} __VER= ${ver} -.if !defined(_PYTHON_VERSION) && \ - !(!empty(_PYTHON_VERSION_MINIMUM) && ( \ +.if !(!empty(_PYTHON_VERSION_MINIMUM) && ( \ ${__VER} < ${_PYTHON_VERSION_MINIMUM})) && \ !(!empty(_PYTHON_VERSION_MAXIMUM) && ( \ ${__VER} > ${_PYTHON_VERSION_MAXIMUM})) +_VALID_PYTHON_VERSIONS+= ${ver} +.if !defined(_PYTHON_VERSION) _PYTHON_VERSION= ${ver} .endif +.endif .endfor .if !defined(_PYTHON_VERSION) IGNORE= needs an unsupported version of Python .endif .endif # defined(_PYTHON_VERSION_NONSUPPORTED) +# Automatically generates FLAVORS if empty +.if empty(FLAVORS) +. if defined(_VALID_PYTHON_VERSIONS) +. for _v in 2 3 +. if ${_VALID_PYTHON_VERSIONS:M${PYTHON${_v}_DEFAULT}} +FLAVORS+= python${_v} +. endif +. endfor +. else +FLAVORS= python2 python3 +. endif +. if !empty(FLAVORS) && empty(FLAVOR) +FLAVOR= ${FLAVORS:[1]} +# XXX: I do not think we need to force the python version here, as the default +# set earlier is there same as the flavor here. +. endif +.endif + # Pass PYTHON_VERSION down the dependency chain. This ensures that # port A -> B -> C all will use the same python version and do not # try to find a different one, if the passed version fits into @@ -483,8 +510,8 @@ _CURRENTPORT:= ${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX} .if defined(_PYTHON_FEATURE_DISTUTILS) && \ ${_CURRENTPORT} != ${PYTHON_PKGNAMEPREFIX}setuptools -BUILD_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}setuptools>0:devel/${PYTHON_PKGNAMEPREFIX}setuptools -RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}setuptools>0:devel/${PYTHON_PKGNAMEPREFIX}setuptools +BUILD_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}setuptools>0:devel/py27-setuptools@${FLAVOR} +RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}setuptools>0:devel/py27-setuptools@${FLAVOR} .endif # distutils support Index: Mk/bsd.port.mk =================================================================== --- Mk/bsd.port.mk +++ Mk/bsd.port.mk @@ -1074,18 +1074,6 @@ .include "${PORTSDIR}/Mk/bsd.commands.mk" -.if !empty(FLAVOR) -. if empty(FLAVORS) -IGNORE= FLAVOR is defined while this port does not have FLAVORS. -. elif ! ${FLAVORS:M${FLAVOR}} -IGNORE= Unknown flavor '${FLAVOR}', possible flavors: ${FLAVORS}. -. endif -.endif - -.if !empty(FLAVORS) && empty(FLAVOR) -FLAVOR= ${FLAVORS:[1]} -.endif - # Do not leak flavors to childs make .MAKEOVERRIDES:= ${MAKEOVERRIDES:NFLAVOR=*} @@ -1462,6 +1450,18 @@ .include "${USESDIR}/${f:C/\:.*//}.mk" .endfor +.if !empty(FLAVOR) +. if empty(FLAVORS) +IGNORE= FLAVOR is defined while this port does not have FLAVORS. +. elif ! ${FLAVORS:M${FLAVOR}} +IGNORE= Unknown flavor '${FLAVOR}', possible flavors: ${FLAVORS}. +. endif +.endif + +.if !empty(FLAVORS) && empty(FLAVOR) +FLAVOR= ${FLAVORS:[1]} +.endif + EXTRACT_SUFX?= .tar.gz .if defined(USE_LINUX_PREFIX) Index: devel/py-args/Makefile =================================================================== --- devel/py-args/Makefile +++ devel/py-args/Makefile @@ -16,4 +16,6 @@ USES= python USE_PYTHON= distutils autoplist +FLAVORS= python2 python3 + .include Index: devel/py-clint/Makefile =================================================================== --- devel/py-clint/Makefile +++ devel/py-clint/Makefile @@ -13,7 +13,9 @@ LICENSE= ISCL -RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}args>=0.1.0:devel/py-args +FLAVORS= python2 python3 + +RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}args>=0.1.0:devel/py-args@${FLAVOR} USES= python USE_PYTHON= autoplist distutils