I have been recently trying to use devel/ansible. This port depends on lang/python2 (its Makefile includes a USE=python:2 line). However, the programs it installs expect /usr/local/bin/python to be present. /usr/local/bin/python is provided by lang/python and could be a symbolic link to a program provided by one of various incompatible Python versions depending on the circumstances. The /usr/local/bin/python string is added by a USES=shebangfix directive. Mk/Uses/shebangfix.mk hardcodes the path of the choosen Python interpreter as ${LOCALBASE}/bin/python I believe this is wrong and shebangfix.mk should use a more specific path such as /usr/local/bin/python2 when the port asks for a specific Python version.
That bug is to be addressed by the python team. The thing is shebangfix has default conversion model, maybe either USES=python or the port itself should provide more clever targets depending on the python option chosen. I think that should be up to USES=python
Possible solution(s): USES= python:2 sets python_CMD = ${LOCALBASE}/bin/python2 USES= python:3 sets python_CMD = ${LOCALBASE}/bin/python3 USES= python sets python_CMD = ${PYTHON_CMD} USES= python:X.Y+ sets python_CMD = ${PYTHON_CMD} USES= python:-X.Y sets python_CMD = ${PYTHON_CMD} USES= python:X.Y-X.Y sets python_CMD = ${PYTHON_CMD} Those are to be set in python.mk. python_OLD_CMD is still left to the port, since this may be either /usr/bin/python* or /usr/bin/env python*
Take, while here
This was fixed long time ago - python_CMD is set to PYTHON_CMD as long as USES=python* is present, so the correct versioned binary is used.