Here's a common pattern with py3- slave ports:
py-foo/Makefile:
RUN_DEPENDS?= ${PYTHON_PKGNAMEPREFIX}bar>0:devel/py-bar USES?= python USES+= zip
py3-foo/Makefile:
MASTERDIR= ${.CURDIR}/../py-foo RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}bar>0:devel/py3-bar USES= python:3
Since USES and *DEPENDS must be duplicated, this is clumsy and error
prone.
What I propose is to introduce PYTHON_PORTNAMEPREFIX which may be set
by the framework to either py- or py3- and is intended to be used
in *_DEPENDS, and PY3_SLAVEPORT knob which is indended to be set
by py3- slave ports, which does two things:
- set PYTHON_PORTNAMEPREFIX to py3-
- force using of python version 3 like USES=python:3 would do
This simple change remove the need for redefining DEPENDS and USES
in a slave port, effectively reducing (most?) py3- slave ports to
three lines, removes the code duplication and also reduces chandes
needed to master ports to replacing py- with ${PYTHON_PORTNAMEPREFIX}
in depends.
The above example is now simplified to:
py-foo/Makefile:
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}bar>0:devel/${PYTHON_PORTNAMEPREFIX}bar USES= python zip
py3-foo/Makefile:
MASTERDIR= ${.CURDIR}/../py-foo PY3_SLAVEPORT= yes
The patch also includes a demonstration of this feature for devel/{py,py3}-flake8.