Bug 196056 - Wrong python interpreter set in Mk/Uses/shebangfix.mk
Summary: Wrong python interpreter set in Mk/Uses/shebangfix.mk
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Dmitry Marakasov
URL:
Keywords: needs-patch, needs-qa
Depends on:
Blocks:
 
Reported: 2014-12-17 09:37 UTC by ftigeot
Modified: 2016-05-27 20:49 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ftigeot 2014-12-17 09:37:34 UTC
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.
Comment 1 Baptiste Daroussin freebsd_committer freebsd_triage 2014-12-17 10:34:04 UTC
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
Comment 2 Marcus von Appen freebsd_committer freebsd_triage 2014-12-18 15:38:00 UTC
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*
Comment 3 Marcus von Appen freebsd_committer freebsd_triage 2014-12-18 15:38:29 UTC
Take, while here
Comment 4 Dmitry Marakasov freebsd_committer freebsd_triage 2016-05-27 20:49:34 UTC
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.