Bug 216479 - Uses/python.mk: specifying USES=python3.3+ and USE_PYTHON=concurrent doesn't produce any ports with USE_DEFAULT_LINKS
Summary: Uses/python.mk: specifying USES=python3.3+ and USE_PYTHON=concurrent doesn't ...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Port Management Team
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-26 05:58 UTC by David Naylor
Modified: 2017-12-12 14:35 UTC (History)
1 user (show)

See Also:


Attachments
Proof of concept fix (473 bytes, patch)
2017-12-11 15:29 UTC, David Naylor
dbn: maintainer-approval?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Naylor freebsd_committer 2017-01-26 05:58:39 UTC
If a port is python 3 only, and it specifies 'concurrent' then all scripts installed into $PREFIX/bin will have a suffix.  Since python defaults to version 2 no port ever gets a script without a suffix.  

However, some ports are split in two: a python2 and a python3 version.  In this case the latter port is correctly handled.  

I can suggest either (or both):
 1) Adding another flag to indicate with version of python the USE_DEFAULT_LINKS should be applied, or
 2) Dynamically detecting that a port only supports a specific major version of python, then specify USE_DEFAULT_LINKS for the default python version for the port's supported major version.  This will exclude ports who's directory name does not start with 'py-'.

I suggest both approaches.  

The affected ports appear to be:
# find . -name Makefile | xargs grep USE_PYTHON | grep concurrent | cut -f 1 -d : | xargs grep USES | grep python:3 | cut -f 1 -d : | sed -e 's|/Makefile||g' -e 's|\./||g'
sysutils/py-diffoscope
ports-mgmt/py-skog
(false positives)
devel/py3-babel
devel/py3-Jinja2
textproc/py3-pager
textproc/py3-MarkupSafe
textproc/py3-chardet
Comment 1 Mathieu Arnold freebsd_committer 2017-12-11 12:46:04 UTC
Fixed with flavors.
Comment 2 David Naylor freebsd_committer 2017-12-11 15:06:53 UTC
This is still broken:
# cd /usr/ports/ports-mgmt/py-skog
# make -V USES
python:3.3+
# make -V PYTHON_VERSION
python3.6
# make -V UNIQUE_DEFAULT_LINKS
no
^^ problem here
Comment 3 David Naylor freebsd_committer 2017-12-11 15:29:11 UTC
Created attachment 188721 [details]
Proof of concept fix

I suggest that the default version, as determined by the first item in the _VALID_PYTHON_VERSIONS, should be used to detect when UNIQUE_DEFAULT_LINKS should be yes.  

The attached is such a proof of concept, however it will not work unless flavors are enables in python.mk - but that is an easy fix.  

If you are happy I can finish the patch and commit it.
Comment 4 David Naylor freebsd_committer 2017-12-11 16:04:29 UTC
But, I was in the area so I finished the patch.  Please see https://reviews.freebsd.org/D13449.  And, apologies for the spam on this bug.
Comment 5 Antoine Brodin freebsd_committer 2017-12-11 16:39:39 UTC
(In reply to David Naylor from comment #2)
Is your ports tree up to date?

I can't reproduce the problem.
Comment 6 David Naylor freebsd_committer 2017-12-11 17:01:28 UTC
(In reply to Antoine Brodin from comment #5)
Ah, I see commit rX today introduced the fix.  I can confirm it fixes comment #2.  

I'm not sure how realistic this situation is, but I do get:
# cd /usr/ports/ports-mgmt/py-skog
# make -V UNIQUE_DEFAULT_LINKS USE_PYTHON="autoplist concurrent distutils noflavors"
no

The proof of concept attached, I believe, will work in this situation as well.
Comment 7 Mathieu Arnold freebsd_committer 2017-12-12 14:35:10 UTC
Added a DEV_WARNING to prevent foot shooting.